We have projects that have been developed using many different versions of Ruby. Since we do not want to constantly update every old project, we need to have many Ruby versions installed on our development machines.
Rbenv Show archive.org snapshot does that for us.
Rbenv installs ruby version and ruby gems to ~/.rbenv/versions/VERSION_NUMBER/...
. This way many different Rubies can be installed at once.
When you run ruby
or gem
or bundler
or any other Ruby binary
.ruby-version
in your directory (or any parent directory)PATH
to the correct Ruby on the flyCheck our card on installing rbenv.
To use a specific Ruby version for your project, add a file .ruby-version
that simply contains the version you want:
2.3.1
If you need to switch the version outside of a project for your current shell, you can also say
rbenv shell 2.3.1
Note that this causes your shell to ignore the .ruby-version
until you close it.
Also see rbenv: How to switch to another Ruby version (temporarily, per project, or globally).
To see the currently selected version (hopefully "2.3.1"), run
rbenv version
It will warn you if the version is not currently installed.
rbenv install 2.3.1
You can skip the version number to install the currently selected one.