rbenv is a robust tool that follows the UNIX methodology to implement per-project selection of Ruby versions and related runtime environment. The rbenv community maintains an ecosystem of plugins, and rbenv has inspired many other forks for managing environments of different programming languages and other software tools.
rbenv works by:
- Having its
shims/directory prepended to PATH environment variable;
- Reading a
.ruby-versionfile in the project's directory that specifies the Ruby version to be activated.
How to install/upgrade
The rbenv-installer script automates installation or upgrading rbenv on your system with either Homebrew (if available) or by using git to install to
For manual installation instructions and more details, see Installation chapter of rbenv README.
Changes since v0.4.0
- Speed up rbenv with dynamically loaded
- Speed up
rbenv rehashwhen there are many Ruby versions with similar sets of executables
- Improve performance of
rbenv-whichfor "system" version
rbenv-execcalling out to
To compile the optional C extension that speeds up rbenv across the board:
# substitute with location where you installed rbenv source: $ cd ~/.rbenv $ src/configure && make -C src
- New plugin hooks
version-originenable plugin authors to hook into version selection logic.
rbenv versions --skip-aliases --barewill only list versions that are not aliases (symlinks) for other versions.
rbenv version-file <dir>finds a
.ruby-versionfile in the target directory or any of its parent directories.
rbenv initnow recognizes and supports fish shell syntax.
rbenv --debug <command>is a shortcut for enabling RBENV_DEBUG.
rbenv()shell function in ksh and dash
- Ubuntu fix: use
- Reliably detect user's current shell in
- Improve detection of completion support for commands
- Fix detecting completions support on OpenBSD
- Check if completion script is readable
- Suppress shell warnings when hashing is disabled by
rbenv()shell function preserves multiline output of
rbenv localnow respects
.ruby-versionfile in parent directories as well
rbenv versionsnow emits a warning when no Ruby versions were found
- Consistently support
rbenv <command> --helpas alternative to
rbenv help <command>
- Improve parsing of git revision in
rbenv --versionwhen rbenv was installed from git
- Export PS4 when RBENV_DEBUG is set for more informative debug output
- Fix incorrect formatting of
rbenv-helpoutput under MAWK (Ubuntu)
awkif both are available
- Fix resolving symlinks in
- Fix iterating through paths that have spaces in them
rbenv rehashwhen paths have spaces in them
- More useful error message when rehash fails on a non-writable directory
rbenv-execfail for invalid Ruby version
- Bail out early if
readlinkis not available
- Properly resolve symlinks when listing hook scripts
- Better error message for
rbenv prefix system
- Fix reading
.ruby-versionon platforms that don't support process substitution
- Remove carriage return characters in
- Fixes rbenv on OpenBSD and other systems that don't support
- Guard against exported
- Ensure that
IFSis reset to its original value within hook scripts