ruby rbenv
abstract
rbenv and ruby-build are shell scripts which install and manage Ruby versions.
basics
- The
~/.rbenv/versions
folder contains installed Ruby versions. - The
~/.rbenv/version
file sets global Ruby for a user. - The
~/.rbenv/shims
folder contains shim executables. - Any
.ruby-version
file sets local Ruby for a folder and its descendents. - Any
RBENV_VERSION
environment variable overrules global and local Ruby.
commands
brew install rbenv |
install rbenv with Homebrew |
brew uninstall rbenv |
uninstall rbenv with Homebrew |
brew upgrade rbenv ruby-build |
upgrade rbenv with Homebrew |
eval "$(rbenv init -)" |
modify shell to use rbenv |
rbenv install 2.6.3 |
install Ruby version 2.6.3 |
rbenv install --list |
show available Rubies |
rbenv shell 2.6.3 |
use Ruby version 2.6.3 |
rbenv shell --unset |
revert to using default Ruby |
rbenv uninstall 2.6.3 |
remove Ruby version 2.6.3 |
rbenv versions |
show installed Rubies |
dependencies
- RVM must not be installed.
examples
Set local Ruby for a project:
cd path/to/myproject echo '2.6.3' > .ruby-version rbenv install --skip-existing 2.6.3
See Installing Ruby versions for details.
faq
- Where are the official docs?
- rbenv installation
- rbenv commands
- rbenv explanation