Install Ruby 1.8.7 on OSX Lion using RVM

I’ve got a brand spanking new MacBook Pro which is running OS X Lion. I use RVM to manage my Ruby versions. So should you…probably.

Anyway, I needed to install Ruby 1.8.7 for a work application, and although doing this using rvm seems to work, it doesn’t. Although rvm will tell you it’s installed Ruby 1.8.7 cleanly, as soon as you try to install a gem it will blow up in your face with a segmentation fault…

/Users/m/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault


So after pulling my hair out for the best part of, oh… about 27 minutes, I came across the solution on stackoverflow. Thought I’d just post it here for my own blogging pleasure. Credit to Matt Sanders for the answer:

As per Matt’s solution, after you’ve installed Xcode from the App Store, downloaded and installed the OSX gcc installer, run the following to get Ruby 1.8.7 installed cleanly using rvm (adjust the patch level to your own needs):

rvm remove 1.8.7-p334
CC=/usr/bin/gcc-4.2 rvm install 1.8.7-p334 --force

I’m happy now.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s