Rbenv
Manage your ruby version
Rbenv
is a ruby version management tool that allows you to handle several versions of ruby on a same machine. Combined with ruby-build
, it also allows to install a given ruby version.
Installation
On MacOS, Rbenv
can be installed using homebrew. It comes by default with ruby-build included.
Then init your rbenv environment:
Usage
Install a given ruby version
Set the global ruby version
The version that will be used by default in your shell if no local version is specified.
This will define the ruby version in ~/.rbenv/version
.
Use a local ruby version
A version that will be used in a given directory/for a given project can be installed like this:
The ruby version is defined in a .ruby-version
file in the given directory. Therefore, sharing a git repo with a .ruby-version
file in the root directory will automatically set the ruby version used for the project.
Useful commands
Last updated