Last Updated: February 25, 2016
·
832
· mremond

Mountain Lion, Ruby and RVM

This is something I do usually on my Mountain Lion OSX environment and when I forget, I lose a lot of time.

When you have trouble installing gem with native extension (like for example MySQL), make sure you are using a vanilla GCC and not llvm-gcc.

To do that, the best way I found is to use brew and use the following commands:

$ brew tap homebrew/dupes
$ brew install apple-gcc42

Then, you can force the compiler to be gcc by adding the following line in your ~/.profile and by sourcing it:

export CC=/usr/local/bin/gcc-4.2

You can then reinstall Ruby (for example 1.8.7):

$ rvm reinstall ruby-1.8.7