Installing Ruby 2.0.0 with RVM and Homebrew on Mac OS X 10.8 Mountain Lion

This is a tutorial on how to install Ruby 2.0.0 on Mac OS X 10.8 Mountain Lion. 

1. Install Xcode and the Command Line Tools

If you don't have it installed I suggest you install Xcode from the Mac App Store and install the command line tools in Xcode Preferences -> Downloads.

Otherwise if you don't want to do that you can download the Xcode standalone command line tools for Mountain Lion at (Note: You will have to login with your Apple Id.).

2. Install Homebrew

ruby -e "$(curl -fsSL"

Now run:

brew doctor

If you get the error:

Error: No such file or directory - /usr/local/Cellar

Run the following:

sudo mkdir /usr/local/Cellar


sudo chown -R `whoami` /usr/local

3. Install RVM

curl -L | bash

After this is complete execute the following in order to use RVM in your current shell:

source ~/.rvm/scripts/rvm

4. Add the following to your ~/.profile in order to source RVM everytime you run

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

5. Check RVM Requirements

rvm requirements

Note the "Missing required packages: ..." statement. 

If you have any missing required packages you will need to install them before continuing by running brew install .

For example, here is the output I had:

$ rvm requirements
Installing requirements for osx/10.8/x86_64, might require sudo password
Skipping `brew update` make sure your formulas are up to date.Missing required packages: autoconf, automake, libtool, pkg-config, apple-gcc42, libyaml, readline, libxml2, libxslt, libksba, openssl, sqlite.
/Users/christopherkaukis/.rvm/scripts/functions/requirements/osx_brew: line 61:
/usr/local/Cellar/openssl/1.0.1e/bin/openssl: No such file or directory
/Users/christopherkaukis/.rvm/scripts/functions/requirements/osx_brew: line 63: /cert.pem: Permission denied
/Users/christopherkaukis/.rvm/scripts/functions/requirements/osx_brew: line 64: /cert.pem: Permission denied
/Users/christopherkaukis/.rvm/scripts/functions/requirements/osx_brew: line 65: /usr/local/Cellar/openssl/1.0.1e/bin/c_rehash: No such file or directory

If you need to install apple-gcc42 and get an error:

Error: No available formula for apple-gcc42

Run the following:

brew tap homebrew/dupes

If you get an error after running this:

Error: Already tapped!

Run the following instead to repair:

brew tap --repair homebrew/dupes

Now you can continue and install apple-gcc42:

From the "Missing required packages: ..." line above, for example I can now execute the following:

brew install autoconf automake libtool pkg-config apple-gcc42 libyaml readline libxml2 libxslt libksba openssl sqlite


6. Run brew doctor again to make sure everything checks out

Execute the following:

brew doctor

If you get an error or warning about your PATH. Such as:

Warning: /usr/bin occurs before /usr/local/bin

Open your ~/.profile and add the following line to the top (or bottom, it shouldn't matter):

export PATH=/usr/local/bin:$PATH

Run brew doctor to check all is swell before continuing.

7. It's now time to install Ruby 2.0.0:

First run the following commands:

rvm get head

followed by:

rvm requirements

If you don't get any errors you can finally install Ruby 2.0.0:

rvm install 2.0.0

To set as your current version of Ruby run the following command:

rvm use 2.0.0

To make it the default Ruby:

rvm default 2.0.0


rvm use 2.0.0 --default

Now every time you open Ruby 2.0.0 will be default. You can always check which version of Ruby you have using the following command:

ruby -v

and where it's located executing the command:

which ruby

I hope this tutorial was useful. You are now setup to run Ruby 2.0.0 on Mac OS X 10.8 Mountain Lion. Shall you have any issues post a comment below and I'll try and help you out.

- Chris

More from the Author