To manage Ruby installations, we can use rbenv
to control what Ruby versions are used. For even simpler operation, there is the rbenv-installer
to automate installation for rbenv
and ruby-build
:
# Download Ruby installer > curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash # See rbenv setup instructions with: '~/.rbenv/bin/rbenv init' # Add rbenv to PATH > echo 'export PATH="~/.rbenv/bin:$PATH"' >> ~/.bashrc > echo 'eval "$(rbenv init - bash)"' >> ~/.bashrc > source ~/.bashrc # Install Ruby > rbenv install -l > rbenv install 3.1.2 > rbenv global 3.1.2