OS: Mac OS X 10.8.2
XCode: Latest with command line tools installed (version 4.6)
Rails: version 3.2.3
I was trying to generate the routes for a project I am working on (been doing that on regular basis), when I got an error message, with a recommendation that I do bundle install and bundle exec. I did, and this time around, the process broke off while compiling the JSON Gem (version 1.7.7).
Doing some research on StackOverflow, the recommendation was to update the XCode’s command line tools, and I did, but that did not solve the problem.
I tried installing the JSON version 1.7.7 separately, and it failed, telling me to look for the error log in:
~/.rvm/gems/ruby-1.9.3-p125/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
Which reads:
/Users/mine/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
I looked for /usr/bin/gcc-4.2, and indeed, it’s not there. But, when I do:
ls -l /usr/bin/gcc
Here’s what I get:
lrwxr-xr-x 1 root wheel 12 Feb 14 15:49 /usr/bin/gcc -> llvm-gcc-4.2
How do I fix this problem?
I think the problem is that when you install the Xcode command line tools, gcc is sym-linked to llvm, and llvm can’t always compile Ruby and gems correctly.
If you install
autoconf,automake, andgccdirectly (or through something like Homebrew), you should be able to fix the compiler errors.