Jakub Arnold
Jakub Arnold

Reputation: 87230

What's a proper way to install Ruby <1.9.3 on OS X Lion with Xcode 4.3?

Until recently I used to have Xcode 4.2 with the osx-gcc-installer installed on top of it, which worked quite well for older versions of Ruby.

The thing is, that now that I installed Xcode 4.3 with the command line tools (for homebrew), I found that I don't have gcc-4.2 on my system.

From what I was able to find, the usual way to install pre 1.9.3 is to either get an older version of Xcode, or using the osx-gcc-installer. I also found a warning saying that if I install osx-gcc-installer over Xcode 4.3, it will cause problems with node.js.

As I'm currently doing both iOS and node.js development alongside Ruby, I can't really do any of these things. Which means I can only work with 1.9.3, which is the only Ruby version that can be compiled with LLVM.

Is there a clean way to install any older version of Ruby without sacrificing Xcode 4.3? The solution that comes to my mind is having gcc-4.2 in some kind of non-system-wide sandbox and specify it's path when installing Ruby, but I'm not really sure how to do this properly.

Upvotes: 2

Views: 412

Answers (1)

nmott
nmott

Reputation: 9604

Update:

See this link for the process required to get GCC-4.2 onto a machine with Xcode 4.3 without overwriting other components.

Xcode 4.3, Homebrew, and Ruby

It will obviate the need for the instructions below:

RVM should work if you set the default compiler for RVM to gcc. Place this in your .bashrc or .zshrc.

export CC=/usr/bin/gcc-4.2

RVM should then use GCC to compile.

If you don't want to have CC set permanently then you could try installing with:

CC=/usr/bin/gcc-4.2 rvm install 1.8.7

Upvotes: 2

Related Questions