Synopsis
rbenv <command> [<args>…]
Description
rbenv respects the .ruby-version file in a project directory by making sure that any ruby, gem, bundle, or other Ruby command invocation automatically invokes the Ruby version configured for that project.
It does so by generating shims for all Ruby executables. As long as rbenv shims directory is prepended to PATH, rbenv automatically ensures transparent switching between Ruby versions.
rbenv looks for available Ruby versions in the $RBENV_ROOT/versions directory.
Commands
- rbenv global [<version>]
-
View or change the global Ruby version
- rbenv local [<version>]
-
View or change the local Ruby version
- rbenv shell [<version>]
-
View or change the Ruby version for the current shell session
- rbenv version
-
View the currently active Ruby version and where it is set from
- rbenv versions
-
List all locally installed Ruby versions known to rbenv
- rbenv install [<version>]
-
(Provided by the ruby-build plugin) Download and install a new Ruby version
- rbenv rehash
-
Regenerate shims for all known Ruby executables
- rbenv which [<command>]
-
View the executable path that a command resolves to
- rbenv init
-
Help bootstrap rbenv into the current shell environment
- rbenv help [<command>]
-
View help text for any rbenv command
Environment Variables
- RBENV_VERSION (default: read from .ruby-version file)
-
The Ruby version name to be used
- RBENV_ROOT (default: ~/.rbenv)
-
The location where rbenv discovers Ruby versions, plugins, and other configuration
- RBENV_DEBUG
-
Activates printing debug information about rbenv internals to standard error
- RBENV_HOOK_PATH
-
Colon-separated list of paths searched for rbenv plugin scripts
- RBENV_DIR (default: $PWD)
-
Directory to traverse bottom-up to locate the .ruby-version file
Plugins
As its core functionality, rbenv only switches between Ruby versions and does nothing else, but offers a plugin mechanism to hook into and override almost any aspect of its default behavior.
The most common plugin for rbenv is ruby-build which facilitates installing new Ruby versions into the $RBENV_ROOT/versions directory.
Read more at https://github.com/rbenv/rbenv/wiki/Plugins