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.