Install last Ruby version on Mac OSX Lion
Posted on January 6, 2012 by Sol

Yesterday I was approached by a friend who needed my help for installing Ruby 1.9.3 on his Mac OSX Lion. After a quick search on http://www.ruby-lang.org/en/ I decided to use rvm for managing the installation.

Using the Ruby Version Manager, or rvm, has the advantage that doesn’t mess up with the default Ruby version from Lion, which at the time of this writing is 1.8.7. With rvm you can have multiple Ruby versions installed on the same machine, which can be handy sometimes.

You will need to be sure that you have git installed on your machine. If you have Xcode installed you have all that you need.

Installing rvm is as simple as running:

1
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

in your Terminal.

Once you have rvm installed, you can install Ruby with a simple command:

1
rvm install 1.9.3

Let’s check what is the default Ruby version now:

1
2
kermit:~ john$ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]

As promised rvm didn’t mess Apple’s default installation! If you want to use 1.9.3 you simply ask rvm to temporary modify your path:

1
rvm use 1.9.3

Let’s check it:

1
2
kermit:~ john$ ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]

Closing your Terminal will revert your path to the default Ruby version.

If you want to learn more about Ruby, or if you are a beginner I recommend you to read the Pickaxe book Programming Ruby 1.9 by D. Thomas, C. Fowler and A. Hunt:

blog comments powered by Disqus