6

I got a new iMac with Lion and installed Xcode 4.3.2. After running

curl -L get.rvm.io | bash -s stable

I opened up a new bash, and used

$ rvm install 1.9.3

to install Ruby 1.9.3, but there were errors and the log said that the C compiler is not there. And rvm requirements says:

$ rvm requirements
  [...]
Xcode 4.3+ users
- please be warned
- only ruby-1.9.3-p125+ is partially supported
- in case of any compilation issues:
 * downgrade to Xcode 4.1
 * uninstall Xcode and install osx-gcc-installer
and reinstall your rubies.

So does that mean I might need to downgrade to Xcode 4.1? What if I want to keep Xcode 4.3.2? Then will 1.9.3-p125+ be able to work, but only partially?

Update: or how about installing Ruby 1.9.2 -- will it work with the latest Rails 3.2.3? If so, how to add gcc? (using Xcode's gcc?)

sarnold
  • 102,305
  • 22
  • 181
  • 238
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
  • What is the output of `cd /tmp ; echo "int main(int argc, char *argv) { return 0; }" > foo.c ; gcc -o foo foo.c ; ./foo && echo success || echo failure` ? – sarnold Apr 17 '12 at 02:43
  • when I type `gcc` all by itself, it says `-bash: gcc: command not found` – nonopolarity Apr 17 '12 at 02:45
  • Try the last piece of advice [on this answer](http://stackoverflow.com/a/8032980/377270): `rvm install 1.9.3 --with-gcc=clang` – sarnold Apr 17 '12 at 02:47
  • 1
    if I use that line, it will say `You requested building with 'clang' but it is not in your path.` – nonopolarity Apr 17 '12 at 02:49
  • 4
    Go to Xcode, Preferences, Downloads, and install the command line tools. That should help, I hope. I'm using Xcode 4.2, I did install gcc separately. But I read elsewhere that in 4.3, when you install the command line tools, you get gcc (or a gcc wrapper for the clang compiler at least). – thundersteele Apr 17 '12 at 02:59
  • After doing so, it actually does install Ruby 1.9.3... although I haven't used it extensively to see that it is all OK... Do you know what it means by "partially supported" in the `rvm requirements`? – nonopolarity Apr 17 '12 at 04:10

2 Answers2

6

To install 1.9.2 or lower you need to follow the instructions in this blog post. It outlines how it get a copy of GCC which does not conflict with Xcode but can be used to build Ruby.

Xcode 4.3, Homebrew and Ruby.

You cannot install the osx-gcc-installer as it will conflict with Xcode 4.3.2, overwriting the working versions of llvm-gcc and clang.

nmott
  • 9,454
  • 3
  • 45
  • 34
-2

install osx-gcc-installer

use latest ruby:

rvm install ruby

it will be 1.9.3-p125 as it's latest ruby

mpapis
  • 52,729
  • 14
  • 121
  • 158
  • ok that's annoying, that's the fix listed as part of the output of RVM in the the question, it does fix the problem, and you still can use both osx-gcc-installer and Xcode. – mpapis Mar 21 '13 at 08:09