$linuxjunkies
>

rbenv(1)

rbenv is a version manager for Ruby that lets you install, switch between, and manage multiple Ruby versions per project or globally.

UbuntuDebianFedoraArch

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

FlagWhat it does
--versionprint the version of rbenv
--helpdisplay help information for rbenv or a specific command

Examples

list all installed Ruby versions; the current version is marked with an asterisk

rbenv versions

set the global Ruby version to 3.2.0 for your user account

rbenv global 3.2.0

set the Ruby version for the current directory by creating a .ruby-version file

rbenv local 2.7.0

set the Ruby version for the current shell session only

rbenv shell 3.0.0

show the full path to the currently active ruby executable

rbenv which ruby

rebuild the shim scripts after installing a new Ruby version or gems with executables

rbenv rehash

output shell initialization code for bash; add to ~/.bashrc or ~/.bash_profile

rbenv init - bash

install Ruby version 3.2.0 (requires ruby-build plugin)

rbenv install 3.2.0

Related commands