rbenv(1)
rbenv is a version manager for Ruby that lets you install, switch between, and manage multiple Ruby versions per project or globally.
Synopsis
rbenv <command> [<args>]Description
rbenv intercepts Ruby commands using shims that point to the selected Ruby version. It reads version specifications from .ruby-version files in your project or from a global ~/.rbenv/version file. rbenv itself doesn't build Ruby—it manages versions installed by plugins like ruby-build.
Installation typically involves cloning rbenv to ~/.rbenv and adding initialization code to your shell profile. The rbenv init command generates the necessary setup for bash, zsh, fish, and other shells.
Common options
| Flag | What it does |
|---|---|
--version | print the version of rbenv |
--help | display help information for rbenv or a specific command |
Examples
list all installed Ruby versions; the current version is marked with an asterisk
rbenv versionsset the global Ruby version to 3.2.0 for your user account
rbenv global 3.2.0set the Ruby version for the current directory by creating a .ruby-version file
rbenv local 2.7.0set the Ruby version for the current shell session only
rbenv shell 3.0.0show the full path to the currently active ruby executable
rbenv which rubyrebuild the shim scripts after installing a new Ruby version or gems with executables
rbenv rehashoutput shell initialization code for bash; add to ~/.bashrc or ~/.bash_profile
rbenv init - bashinstall Ruby version 3.2.0 (requires ruby-build plugin)
rbenv install 3.2.0