rbenv common commands

Public, Other Languages

harrylevine

Created: Mar 21, 2015     Updated: Feb 18, 2019


From the rbenv GitHub site

rbenv versions lists all Ruby versions known to rbenv, and shows an asterisk next to the currently active version.

$ rbenv versions
  1.8.7-p352
  1.9.2-p290
* 1.9.3-p327 (set by /Users/sam/.rbenv/version)
  jruby-1.7.1
  rbx-1.2.4
  ree-1.8.7-2011.03

rbenv local sets a local application-specific Ruby version by writing the version name to a .ruby-version file in the current directory

$ rbenv local 1.9.3-p327

rbenv global sets the global version of Ruby to be used in all shells by writing the version name to the ~/.rbenv/version file. This version can be overridden by an application-specific .ruby-version file, or by setting the RBENV_VERSION environment variable.

$ rbenv global 1.8.7-p352

The rbenv install command doesn't ship with rbenv out of the box, but is provided by the ruby-build project. If you installed it either as part of GitHub checkout process outlined above or via Homebrew, you should be able to:

# list all available versions:
$ rbenv install -l

# install a Ruby version:
$ rbenv install 2.0.0-p247