Brian Dunagan

October 19 2011
Ruby Tip: 1.8.7 and 1.9.2, Side by Side

Recently, I needed to run rake test on a Ruby gem with both Ruby 1.8.7 and 1.9.2. I wanted to figure out why Travis CI was failing for the gem. Not a problem with rvm, even on Lion (10.7).

To install a version of Ruby, use rvm install:

[~]$ export CC=/usr/bin/gcc-4.2 # Use this for Lion
[~]$ rvm install 1.8.7

You can check that it’s installed with rvm list:

[~]$ rvm list
rvm rubies

=> ruby-1.8.7-p352 [ x86_64 ]
   ruby-1.9.2-p290 [ x86_64 ]

To use Ruby 1.8.7 for the Terminal session, use rvm use:

[~]$ rvm use 1.8.7

Seriously, use rvm. It’s awesome.

Searching GitHub Wikis with Gollum Ruby Tip: Sort a hash recursively
LinkedIn GitHub Email