rbenv – Ruby version manager

rbenv is an alternative to rvm for managing your Rubies. You can find some articles comparing the two. In general, rbenv is more lightweight without overriding the cd and gem command which rvm does and their similarities outweigh their differences. Here is a great article written by Jonathan Jackson about the two solutions.

 

For Mac users, you could install rbenv using Homebrew. Otherwise, you need to checkout the repository on GitHub.

 

So here is the installation on OS X.

1. Update Homebrew to the latest version.

brew update

 

2. Install rbenv and ruby-build using Homebrew.

brew install rbenv ruby-build

 

3. Add the following line to your shell profile, if your using the default shell, that is ~/.profile.

eval "$(rbenv init -)"

 

4. Restart the shell.
 

5. List the available Ruby versions.

rbenv install -l

 

6. Let’s install the 1.9.3-p547.

rbenv install 1.9.3-p547

 

7. Set the 1.9.3-p547 as global default.

rbenv global 1.9.3-p547

 

8. List the installed Rubies.

rbenv versions

 

9 All the installed Rubies are located at ~/.rbenv/versions similar to pyenv which is a fork from rbenv.
 

10. Whenever you have installed a new Ruby or a gem which provides a command, run the following in order to initialize the Shim again.

rbenv rehash

 

Done =)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s