Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 40 million developers.Sign up
rehashmechanism for versions of bash that complain about clobbering
RBENV_DIRto avoid having to unset
rbenv-version-file: ensure that the version file is a file
rbenv init -: fix output to work without args and
rbenv shell: better error message when shell integration wasn't enabled
Enable freezing rbenv version via
rbenv version-name > .ruby-versionin the shell
rbenv-which: avoid changing PATH unless necessary
rbenv-prefix: do not silence rbenv-which errors for system version
- Remove deprecated
- Remove support for
.rbenv-versionlegacy version file
- Remove support for
globallegacy global version files
- Add support for
rbenv shell -style of invocation that restores previous version
- Adopt Contributor Covenant 1.4
sourcefor fish shell
- Unset CDPATH if it's set by the user
rbenv <cmd> --helpfor
- Expand literal tilde in PATH
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
- rbenv now prefers
for specifying local application-specific versions. The
.ruby-versionfile has the same format as
compatible with other Ruby version
ruby-local-execand moved its functionality into the
rubyshim. See the ruby-local-exec wiki
- Modified shims to include the full path to rbenv so that they can be
invoked without having rbenv's bin directory in the
rbenv helpso that usage and documentation is stored as a
comment in each subcommand, enabling plugin commands to hook into
the help system.
- Added support for full completion of the command line, not just the
rbenv --versionfor printing the current version of rbenv.
/usr/lib/rbenv/hooksto the plugin hook search path.
Other changes and bug fixes
- Sped up
rbenv initby avoiding rbenv reinitialization and by
using a simpler indexing approach.
- Updated installation instructions for Zsh and Ubuntu users.
rbenv prefixwith system Ruby versions.
rbenv execto avoid prepending the system Ruby location to
$PATHto fix issues running system Ruby commands that invoke other
rbenv rehashto ensure it exits with a 0 status code under
normal operation, and to ensure outdated shims are removed first
rbenv rehashto run
hash -rafterwards, when shell
integration is enabled, to ensure the shell's command cache is
- Removed use of the
+=operator to support older versions of Bash.
- Adjusted non-bare
rbenv versionsoutput to include
- Improved documentation for installing and uninstalling Ruby
rbenv versionsnot to display a warning if the currently
specified version doesn't exist.
- Fixed an instance of local variable leakage in the
rbenv shellto ensure it exits with a non-zero status on
rbenv whichto account for path entries with spaces.
rbenv initto accept option arguments in any order.
- Added an
rbenv rootcommand which prints the value of
$RBENV_ROOT, or the default root directory if it's unset.
- Clarified Zsh installation instructions in the Readme.
- Removed some redundant code in
- Fixed an issue with calling
readlinkfor paths with spaces.
- Changed Zsh initialization code to install completion hooks only for
- Added preliminary support for ksh.
rbenv rehashcreates or removes shims only when necessary instead
of removing and re-creating all shims on each invocation.
- Fixed that
RBENV_DIR, when specified, would be incorrectly
expanded to its parent directory.
- Removed the deprecated
- Added a
rbenv initfor skipping the
automatic rehash when opening a new shell.
- Changed the
rbenvcommand to ensure that
RBENV_DIRis always an
absolute path. This fixes an issue where Ruby scripts using the
ruby-local-execwrapper would go into an infinite loop when
invoked with a relative path from the command line.
rbenv local. The
set-commands are deprecated and will be
removed in the next major release.
- rbenv now uses
- Added a
ruby-local-execcommand which can be used in shebangs in
#!/usr/bin/env rubyto properly set the project-specific
Ruby version regardless of current working directory.
- Fixed an issue with
rbenv rehashwhen no binaries are present.
- Added support for
rbenv-sh-*commands, which run inside the
current shell instead of in a child process.
- Added an
rbenv shellcommand for conveniently setting the
- Added support for storing rbenv versions and shims in directories
- Added support for debugging rbenv via
set -xwhen the
$RBENV_DEBUGenvironment variable is set.
- Refactored the autocompletion system so that completions are now
built-in to each command and shared between bash and Zsh.
- Added support for plugin bundles in
/usr/local/etc/rbenv.dto the list of directories searched
for rbenv hooks.
- Added support for an
$RBENV_DIRenvironment variable which
defaults to the current working directory for specifying where rbenv
searches for local version files.
- Fixed rbenv to be more resilient against nonexistent entries in
- Made the
rbenv rehashcommand operate atomically.
- Modified the
rbenv initscript to automatically run
rbenv rehashso that shims are recreated whenever a new shell is opened.
- Added initial support for Zsh autocompletion.
- Removed the dependency on egrep for reading version files.
- Fixed a syntax error in the
-efrom the shebang in favor of
set -eat the top of
each file for compatibility with operating systems that do not
support more than one argument in the shebang.