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

Mar 2013

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

comment icon72 comment(s) |

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 <missing package name>.

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

Subscribe to our Networks

Popular Tags by Christopher

IW on Facebook


March 10, 2013


Thank You

I am new on this. You saved me a lot time. A instruction with verification, and fixing mistakes are much more valuable to readers. Thank you again.

March 10, 2013

Mick Huang

Thank you Chris, this is the

Thank you Chris,

this is the most detailed and clear tutorial that worked out perfectly for me, a non CS graduate who's learning everything from the ground. Thank you for taking the effort to make this post. Cheers


March 11, 2013



Seriously, I never leave comments, but this has got to be one of the best instructions ever! Thank you so much!!!! You made it so clear and easy, even fixing common errors. You're awesome!

March 14, 2013


the first time you put "rvm

the first time you put "rvm requirments" instead of "rvm requirements" as a command.

March 14, 2013


Thank you.

It worked perfectly.

I've been trying to install Ruby 2.0.0 for a long time, and always had problems with one thing or another. Solution: Following this guide step by step.

Thank you very much!

March 17, 2013



Hi Chris,
I have a configuration error during ruby 2.0 installation. This is the error description from configure.log:
[2013-03-17 11:21:57] ./configure
current path: /Users/EugeneG/.rvm/src/ruby-2.0.0-p0
command(7): ./configure --prefix=/Users/EugeneG/.rvm/rubies/ruby-2.0.0-p0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libxml2:/usr/local/opt/libxslt:/usr/local/opt/libksba:/usr/local/opt/openssl:/usr/local/opt/sqlite --disable-install-doc --without-tcl --without-tk --enable-shared
configure: WARNING: unrecognized options: --without-tcl, --without-tk
checking build system type... i386-apple-darwin12.2.0
checking host system type... i386-apple-darwin12.2.0
checking target system type... i386-apple-darwin12.2.0
checking whether the C compiler works... no
configure: error: in `/Users/EugeneG/.rvm/src/ruby-2.0.0-p0':
configure: error: C compiler cannot create executables

Please help me to solve this problem. Thanks.

March 17, 2013


Eugene, It sounds like you


It sounds like you didn't install the Xcode command line tools possibly. You will need these to build Ruby.

March 17, 2013



Problem is solved.

March 17, 2013


Sweet Eugene! Thanks for

Sweet Eugene! Thanks for letting me know!

March 17, 2013



You made my day. I still don't understand how rvm, gems and ruby are supposed to work, but at least it works now! Thank you!

March 19, 2013

Peter Bailey

Good job

You've done a beautiful job of combining both Homebrew and RVM. That's what's confused me in the past--which to use.

Thank you,

April 6, 2013

Just another programmer

One additional issue

First of all thanks for the excellent guide!

On step #7, after typing "rvm requirements" I still got the same error message with the cert.pem that was supposed to be handled earlier (on step #5).

The way I worked around it was:

rvm --autolibs=4 requirements ruby-2.0.0

and then again:

rvm requirements
now it returned "clean" and I could continue with:
rvm install 2.0.0

April 10, 2013


On running 'rvm requirements'

On running 'rvm requirements' I am having hard time installing apple-gcc42. I am getting below error.
[2013-04-10 11:56:50] requirements_brew_libs_install
Warning: Your Xcode (4.5) is outdated
Please install Xcode 4.6.1.
Error: SHA1 mismatch
Expected: 8fadde2a159082d6474fe9e325b6301e3c0bc84f
Actual: 51745f4f2c80cbbb90cf33afc17cf0601cea9d92
Archive: /Library/Caches/Homebrew/apple-gcc42-4.2.1-5666.3.pkg

Can anyone please suggest any steps to resolve this

April 10, 2013


Looks like you need to update

Looks like you need to update Xcode and the command line tools. Homebrew doesn't like your current version of Xcode. The only way around installing a new version of Xcode is possibly trying to install an older version of apple-gcc package, but I can't guarantee that will work. You can view all versions available in Homebrew with the following command:

brew versions apple-gcc42


brew search apple-gcc42

This will tell you where the older packages are located and you will have to "tap" or activate that repository.

So, for example, if it came back and said something like homebrew/versions/apple-gccXYZ you will have to run:

brew tap homebrew/versions

Then run:

brew install apple-gccXYZ

Again, I can't gurantee this will work as I have not tried it, but these are your two options I see. They both may work, or only one may work. Let me know if it helps.

April 13, 2013



Great instructions.

Thank you.

April 16, 2013

Stephen Fasano

The Best Ruby Installation Guide for Mac

Thanks a lot. This saved me a ton of time!

April 19, 2013


After running the first line,

After running the first line, it errors and tells me to remove my existing homebrew install. I do so, but get an error related to a font directory. I continued nonetheless and began the homebrew install steps, and get a few screens of errors, all like the first one below. After a few screens of that error (different files), I get the last two errors.

error: unable to unlink old 'Library/Homebrew/version.rb' (Permission denied)
fatal: Could not reset index file to revision 'origin/master'.
Failed during: git reset --hard origin/master

May 7, 2013


problem installing ruby

when running rvm requirements I am receiving the following error:

Michael-Ennos-MacBook-Air:~ michaelenno$ rvm requirements
Installing requirements for osx, might require sudo password.
Updating certificates in '/usr/local/etc/openssl/cert.pem'.
Sorry, try again.

May 7, 2013


It looks like when it asked

It looks like when it asked you for your password you typed it in wrong.

May 19, 2013


Nice save's a lot

Nice save's a lot of time for me.

May 20, 2013

Kevin Lorenz

I can't tell you how much

I can't tell you how much your tut has helped me!!!!! Thank you soooooo much!!!

May 22, 2013

Simon C

Thank you

I just want to say thank you for this fantastic article. I am trying to set up ruby to work with other things and your hard work on this post has really helped me and I really appreciate the work you've put into this! Thank you very much.

Kind regards,
Simon – from the UK.

June 7, 2013

Heidi W.

brew doctor Warning Unbrewed static libraries

Hi Christopher,

Just ran brew doctor after installing Homebrew and got the following warning:

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:

Question: How do I delete Unexpected static libraries (I previously followed a very old tutorial with older version of Ruby - never used those libraries, or Ruby)? Or do I need to delete the existing static libraries?

I'm new at all of this (Mac Terminal, Ruby) and don't want to mess it up, so will not proceed until I hear from someone, how to proceed.


June 7, 2013


Heidi, I have never seen


I have never seen these errors before. I did a little google searching for you and found this which I think might help:

If it was me, I would probably try removing or deleting it. I like to live on the wild side. ;)

Sorry I don't have an absolute answer for this.

If you want to delete them, use the "rm" command. You may have to use sudo and type your password if you don't have permissions to do so. Since the files in question are in /usr/local I don't think you have worry about harming much unless you installed other software relying on libraries in that directory (usually user installed library and applications).

Does that make sense? Hope it helps some.

  • Chris
June 7, 2013

Heidi W.

how to remove?

Hi Chris,

I agree with removing the files, but I don't know how to use the "rm" command. Would you please be more specific? I am very grateful for all your help.


June 7, 2013

Heidi W.


Hi Chris,

Not sure what difference is between delete and remove, but I would prefer to delete, as opposed to moving the files elsewhere, because I have no clue what to do with them.

Is this correct - with safeguard of confirming removal/deletion?

rm -i libhistory.a

and then for 2nd file:

rm -i libreadline.a


June 11, 2013

Heidi W.

Success! more questions

Hi Chris,

You'll be happy to know that I did it --- thanks to you EXCELLENT instructions.
Install of ruby-2.0.0-p195 - #complete

Do you have any instructions for installing current version of Rails, and a local server - which db is the easiest to use for beginners?

What else do I need to install to get going (I just signed up for a beginning class with O'Reilly School of Technology) but they are using an older version of Ruby that will not work on my Mac (OS X 10.8.4) so I need to get everything set up on my Mac and would like to use TextMate as the text editor. All of this information, for us beginners using Mac OS X 10.8, is difficult to find in one place on the web, but so far, YOUR information has been the MOST RELIABLE!

Thank you!

June 13, 2013

Heidi W.

-bash: puts: command not found

Hi Chris,

I have successfully installed Ruby 2.0.0 and Rails 3.2.13 using Homebrew as per your instructions, but now my Terminal can't find the -bash: puts: command.

How do I find that using the terminal?

Last login: Wed Jun 12 23:00:38 on ttys000
-bash: puts: command not found
Heidis-MacBook-Pro:~ Heidi$


June 14, 2013


Heidi, I don't know of any

Heidi, I don't know of any puts command. That's a ruby command.

June 15, 2013

Heidi W.

Re-install Ruby?

Hi Chris,

Somehow, the Ruby 'puts' command was removed during Rails 3.2.13 install because the line, '-bash: puts: command not found' was not showing in my Terminal before Rails install, and I did nothing in between brew Ruby install and rails install.

If I were to re-install Ruby 2.0.0p195 using Homebrew, would I need to first 'delete' Ruby, or would the new install rewrite over the current install without deleting it first?


June 21, 2013


Heidi, sorry for the late

Heidi, sorry for the late reply. Didn't see this comment.

If you can, I would start from scratch. Are you able to figure out what and how to delete everything?

You can remove Homebrew using this shell script:

Save it on your computer and run it in shell name_of_script

The name you save it as doesn't matter.

You can remove RVM a couple ways:

rvm implode


rm -rf ~/.rvm

and delete out the lines in your .bash_profile, .profile files referencing anything RVM.

Then, try it from the start.

Let me know if that helps at all. You can email me too (firstname at this domain dot com).

June 14, 2013


Worked perfectly

Thanks Christopher,
really helpful guide

June 17, 2013


Awesome Tutorial

Thanks for this great tutorial. Thanks for addressing possible issues that may arise during the process. Appreciate the help.

June 17, 2013


Thank you!

I hate installations and just thinking about it makes me sweat. Thanks to your guide, it worked like a breeze.

June 24, 2013

Jeremy King

Very helpful

Thank you for these instructions. It was easy to follow and helpful.


June 29, 2013


Not surprised I got an error.

Error running 'make -j4',
please read /Users/john/.rvm/log/ruby-2.0.0-p247/1372552252_make.log
There has been an error while running make. Halting the installation.

I go to that file and its just a bunch of spaghetti.

also.. brew doctor says I have an outdated version of git. then when I go to update it says it's not even installed, yet.. I clearly have git working just fine.

July 3, 2013

Agnan Zakariya

simple is beautiful

Very helpful, the Instruction very simple to my follow. Thanks in Advance

July 4, 2013



That's SUPER!

July 6, 2013


Thanx a lot

Have tried 4 other guides but only this one passed smoothly to success. Many thanx for this.

July 6, 2013


Thank you & 1 quick note

Thank you for this great post, very helpful.
Just wanted to point out that, for some users, your recommended additions to the ".profile" file will actually be in the ".bash_profile" file.

July 8, 2013


Thank you

I was stuck and this helped me out. Thanks a lot!

July 12, 2013


Helped a lot, thanks!

Helped a lot, thanks!

July 13, 2013


thanks a lot.

finally I have ruby 2.0 installed. so pround.

July 15, 2013



Great tutorial. Helped me a lot. Again THANKS!!!

July 16, 2013


Thank you :)

Thank you :)

July 28, 2013


Thank you so much... I

Thank you so much... I finally installed Ruby on OSX Lion

July 30, 2013


Excellent notes!!! Thank you!

Excellent notes!!! Thank you!

July 30, 2013

Dave Sag

~/.bash_profile not ~/.profile

Great instructions but one minor alt. The Terminal app no longer reads the ~/.profile file so be sure to put any edits for that into ~/.bash_profile instead.



August 14, 2013


It depends. Here is the bash

It depends.

Here is the bash man page explaining it better:

July 31, 2013


I'm getting this error... any guesses?

Hi... getting this .....

Error running './configure --prefix=/Users/JohnHaden/.rvm/rubies/ruby-2.0.0-p247 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --disable-install-doc --without-tcl --without-tk --enable-shared',
please read /Users/JohnHaden/.rvm/log/ruby-2.0.0-p247/1375249833_configure.log
There has been an error while running configure. Halting the installation.

Any ideas?


August 14, 2013


It looks like you are missing

It looks like you are missing some of the requirements. Look at the log file mentioned and it might show some more information. I'm afraid I'm unable to help without seeing the log error output.

August 8, 2013


Extremely helpful, thank you

Extremely helpful, thank you sooo much!!

August 27, 2013

Jonathan Kempf

Best Ruby Tutorial Ever

This worked like a charm, even on OSX Lion. Thank you for taking the time to write this, it really helped me out.

September 6, 2013


Hi, I'm currently at rvm

Hi, I'm currently at rvm requirements, and am getting this error. What should I do?

$ rvm requirements
Checking requirements for osx.
Installing requirements for osx.
Updating system.
Installing required packages: gcc46, libyaml, readline, libksba, openssl..........
Error running 'requirements_osx_brew_libs_install gcc46 libyaml readline libksba openssl',
please read /Users/jskchang/.rvm/log/1378504338/package_install_gcc46_libyaml_readline_libksba_openssl.log
Requirements installation failed with status: 1.

September 16, 2013


Need to update ruby from 1.9.3 to 2.0.0

Am facing issue in rvm requirement:

Error running 'requirements_osx_brew_libs_install automake',
please read /Users/monitor/.rvm/log/1379342740/package_install_automake.log
Requirements installation failed with status: 1.

September 29, 2013


Thank you

Best instructions I've seen on the subject. Simple.

October 30, 2013

Luis Carlos Cruz Carballo

Hi, To avoid chown command if


To avoid chown command if you are not the admin(staff group) this may help.

I just put the url of my reply instead the text to avoid write it twice.

November 13, 2013



Great tutorial on upgrading ruby on mac. Well elaborate and clear instructions on how to install or upgrade the Ruby on mac. Well done!!!

November 23, 2013

Andy Fitzgerald

Thank you!

Great tutorial! And it works (which is even better – and rarer).
One possible correction: I don't know if others had this issue, but for the very first command I needed to use:
ruby -e "$(curl -fsSL"
instead of:
ruby -e "$(curl -fsSL"
as you have listed. I pulled this from the Homebrew page. Maybe the "install" part is supposed to be obvious; I didn't know to put it there. (I'm very new to CL)
Anyway, a small matter – and something I mention just so that others don't get hung up on it and miss this otherwise excellent guide.

December 1, 2013

David Williams

2. Installing Homebrew

Hi Chris,

I am getting stuck on 2. Installing Homebrew. I have downloaded Xcode (Version 5.0.1 5A2053) and have installed the Command Line tools as instructed. I am running on OSX 10.8.5. I have ruby 1.8.7 currently installed.

I am getting the following error when I run the command at 2. above. Any help would be greatly appreciated.

dggwilliams$ ruby -e "$(curl -fsSL"

-e:4: syntax error, unexpected '<'

-e:5: syntax error, unexpected '<'

-e:7: syntax error, unexpected '<'

-e:8: syntax error, unexpected '<'

-e:8: syntax error, unexpected tIDENTIFIER, expecting $end

December 2, 2013

David Williams

Hi Chris, It seems this is

Hi Chris,

It seems this is sorted out. I ran the following instruction:

ruby -e "$(curl -fsSL"

instead of:

ruby -e "$(curl -fsSL"

The latter works OK. Rest of instructions worked perfectly.


December 3, 2013


Ruby Installation Steps on Mac


Please update the Homebrew installation command,

At present the command that you have given

ruby -e "$(curl -fsSL"

is not working.

Instead the following will work,

ruby -e "$(curl -fsSL"

December 10, 2013


rvm requirements error

Installing on OS X 1.8.5. I get the following when I run "rvm requirements" (step 5). NB: This is my second attempt. I previously made it up to "rvm install 2.0.0" before getting an error that appeared to be caused by not having command line tools installed with Xcode. "rvm install 2.0.0" still didn't work after installing command line tools, so I attempted to remove homebrew and rvm and start again. Any help would be appreciated.

Updating systemawk: illegal statement
input record number 1, file
source line number 8
Error running 'requirements_osx_brew_update_system ',
showing last 15 lines of /Users/madelinezilfi/.rvm/log/1386730952/update_system.log
return $ret
brew update || {
typeset ret=$?;
rvm_error "Failed to update Homebrew, follow instructions here:
and make sure `brew update` works before continuing.";
return $ret
current path: /usr/local/Cellar
command(2): requirements_osx_brew_update_system
Already up-to-date.
Requirements installation failed with status: 2.

December 12, 2013


Nevermind. Fixed this by

Nevermind. Fixed this by removing everything, including Xcode, and reinstalling.

December 11, 2013



Any changes in here needed for Mavericks?


December 11, 2013


Mavericks, again

Yeh, the "rvm requirements" thing is taking forever and ever on my Mavericks Mac.


December 11, 2013

Peter Bailey

Mavericks, again

Running the "rvm requirements" command is taking a really, really long time. Is this normal? I'm on Mavericks.


January 16, 2014


Installation of Ruby on Rails problem

Here is the error, please let me know what is wrong with the installation.

$ rvm requirement
Unrecognized command line argument: 'requirement' ( see: 'rvm usage' )
gZIA-2:~ ghezal$ rvm requirements
Checking requirements for osx.
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
==> Upgrading 1 outdated package, with result:
openssl 1.0.1f
==> Upgrading openssl
==> Downloading
curl: (6) Could not resolve host:; nodename nor servname provided, or not known
Trying a mirror...
==> Downloading
curl: (6) Could not resolve host:; nodename nor servname provided, or not known
Error: Download failed:
Requirements installation failed with status: 1.

May 13, 2014


I am newbie to mac, you saved my time..


thanks for the article..thats really awesome..

June 9, 2014


Thank you.

Thank you! This page saved me a lot of hassle.

July 3, 2014


Re: ruby version configuration help needed

its a great article.

I had lots of missing dependencies but with the above help I installed 3 ruby version. As default it installed latest one, then I installed the version I need to work with, and the one which was coming with the mac default installation in my system.

So I tried many ways to set a particular version as my default permanent version to be used as using .bash_profile with entries -s "$HOME/.rvm/scripts/rvm" && source "$HOME/.rvm/scripts/rvm". but could not help me.

I am new to this so if you could help me it would be really appreciable and great !

Thanks in advance !

August 17, 2014


got a warning message about link gcc46 as ran brew doctor

After I completed installing rvm, I ran rvm requirements. Systems prompted Nings-MacBook-Air:~ NingJoeChang$ rvm requirements
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.

However, when I ran "brew doctor" again it gave me a warning, Nings-MacBook-Air:~ NingJoeChang$ brew doctor

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run brew link on these:

Is it matter? Would you please kindly let me know how to fix it if it is necessary.,
Big thanks.