How do I Install Ruby 1.9.2 with RVM on Mac OSX 10.7.3 LION?
For Lion, you need to install GCC-4.2 and set the compile to point to it:
Download the gcc-4.2
This is needed for Xcode 4.2 only. Ruby project should be built using gcc rather than llvm-gcc (Lion).
Download it from https://github.com/kennethreitz/osx-gcc-installer/downloads/
Open "Downloads"
Double click on "GCC-10.7-v2.pkg" to install
Setting the compiler
For Lion, Rubies should be built using gcc rather than llvm-gcc.
Since /usr/bin/gcc is linked to /usr/bin/llvm-gcc-4.2, we need to set the default complier to gcc-4.2
Set default complier to gcc-4.2, type command: export CC=/usr/bin/gcc-4.2
Either you are running older RVM or gcc-4.2
could not be found.
Are you sure https://github.com/kennethreitz/osx-gcc-installer/downloads/ was correctly installed?
RVM automatically detects that gcc-4.2 is available and uses it for compilation, so you should be fine after:
rvm get headrvm reinstall 1.9.2 -j 2
I have added -j 2
to speed up compilation, replace the 2
with number of cores +1
There are better ways now. You can use MacPort to download and compile everything.
- Install MacPort http://www.macports.org/
From a terminal window, install Ruby
sudo port selfupdatesudo port install ruby 1.9.2
Better yet, you can use RVM to install a specific version of ruby depending on where you are:
- Install MacPort
- Install RVM https://rvm.io
cd [my work dir]
rvm 1.9.2