rbenv
Manage your app's Ruby environment.
Installation
The rbenv-installer script idempotently installs or updates rbenv on your system. If Homebrew is detected, installation will proceed using brew install/upgrade
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
Configuration
Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility.
$ vim ~/.bashrc
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
Restart your shell so the path changes take effect.
exec $SHELL
Commands
Lists all Ruby versions known to rbenv, and shows an asterisk next to the currently active version.
rbenv versions
list latest stable versions.
rbenv install -l
list all local versions.
rbenv install -L
install a Ruby version.
rbenv install 3.1.2
Sets the global version of Ruby to be used in all shells by writing the version name to the ~/.rbenv/version file.
rbenv global 3.1.2
exec $SHELL
ruby -v
Sets a local application-specific Ruby version by writing the version name to a .ruby-version file in the current directory.
rbenv local 3.1.2
Uninstalling rbenv.
rm -rf `rbenv root`
Uninstalling rbenv on MacOS.
brew uninstall rbenv
Uninstalling rbenv on Debian, Ubuntu, and their derivatives.
sudo apt purge rbenv