+1
Daily
16,743
stars
1,423
forks
287
watchers
443
prs
1,066
issues
14
releases
README
Seamlessly manage your app’s Ruby environment with rbenv.
rbenv is a version manager tool for the Ruby programming language on Unix-like systems. It is useful for switching between multiple Ruby versions on the same machine and for ensuring that each project you are working on always runs on the correct Ruby version.
How It Works
After rbenv injects itself into your PATH at installation time, any invocation of ruby, gem, bundler, or other Ruby-related executable will first activate rbenv. Then, rbenv scans the current project directory for a file named .ruby-version. If found, that file determines the version of Ruby that should be used within that directory. Finally, rbenv looks up that Ruby version among those installed under ~/.rbenv/versions/.
You can choose the Ruby version for your project with, for example:
sh
cd myproject
choose Ruby version 3.1.2:
rbenv local 3.1.2
Doing so will create or update the .ruby-version file in the current directory with the version that you've chosen. A different project of yours that is another directory might be using a different version of Ruby altogether—rbenv will seamlessly transition from one Ruby version to another when you switch projects.
Finally, almost every aspect of rbenv's mechanism is [customizable via plugins][plugins] written in bash.
The simplicity of rbenv has its benefits, but also some downsides. See the [comparison of version managers][alternatives] for more details and some alternatives.
Installation
On systems with Homebrew package manager, the “Using Package Managers” method is recommended. On other systems, “Basic Git Checkout” might be the easiest way of ensuring that you are always installing the latest version of rbenv.
Using Package Managers
1. Install rbenv using one of the following approaches.
Homebrew
On macOS or Linux, we recommend installing rbenv with Homebrew.
sh
brew install rbenv
Debian, Ubuntu, and their derivatives
[!CAUTION]
The version of rbenv that is packaged and maintained in official
Debian and Ubuntu repositories is _out of date_. To install the latest
version, it is recommended to install rbenv using git.
sh
sudo apt install rbenv
Arch Linux and its derivatives
Archlinux has an official package which you can install:
sh
sudo pacman -S rbenv
Fedora
Fedora has an official package which you can install:
sh
sudo dnf install rbenv
OpenSUSE Tumbleweed
OpenSUSE has an official package which you can install:
sh
sudo zypper in rbenv
2. Set up your shell to load rbenv.
sh
rbenv init
3. Close your Terminal window and open a new one so your changes take effect.
That's it! You are now ready to install some Ruby versions.
Basic Git Checkout
[!NOTE]
For a more automated install, you can use rbenv-installer. If you do not want to execute scripts downloaded from a web URL or simply prefer a manual Top issues
#187Fall back to other binary in PATH if gem-installed binary not installed in current ruby23 comments · 2012-02-02#1455rbenv shell specs- refactor to test the behavior instead of the implementation?6 comments · 2022-10-15#1631rbenv init incorrectly assumes rbenv is installed if zshrc file contains the eval command even if it's commented out.5 comments · 2025-08-27#1573fish: rbenv init creates duplicates in PATH4 comments · 2024-05-16#865rbenv-exec only allows executables found by rbenv-which4 comments · 2016-02-02#1501Make the "version not installed" error more helpful3 comments · 2023-04-19#1663unsupported shell: "l"2 comments · 2026-10-24#1647rbenv install does not clear shell (macOS/zsh) hash table, causing stale ruby path after installation2 comments · 2026-03-30
Discussions
#1651ccline — type Ruby/rbenv questions at your prompt, get the command0 comments · 2026-06-10#1644DX: dependencies0 comments · 2026-02-26#1635building ruby in windows using rbenv and ruby-build on msys2 ucrt64 (lot of hacks)0 comments · 2025-10-07#1597Ruby 3.3.6 does not want to build.3 comments · 2024-11-18#1588Is `rbenv` restricted to a single `system` Ruby?1 comments · 2024-09-04#1580rbenv 1.3.00 comments · 2024-07-05#1577Update information about Debian dependencies?1 comments · 2024-07-01#1562rails always not found even though I have installed it1 comments · 2024-04-07
Latest release
rbenv 1.3.2 v1.3.2 2025-01-08What's Changed Fix traversing PATH for bash < 4.4 by @mislav in https://github.com/rbenv/rbenv/pull/1606 Special shoutouts to @BiggerNoise for helping me debug rbenv init @Tobias-pwnr for reporting a bug with bash < 4.4 @pnghai for the proposed fix 1605 Full Changelog: https://github.com/rbenv/rbenv/compare/v1.3.1...v1.3.2