I've just upgraded to OS X Mountain Lion (regretting it already).
Having issues with installing the json gem's native extentions.
Before 10.8 I had Command Line Tools installed. RVM with Ruby 1.9.2.
Upgraded to 10.8 and did the following stuff:
- sudo chown -R
whoami
/usr/local - brew update
- brew tap homebrew/dupes
- brew install apple-gcc42
- Installed XCode 4.4
- Installed Command Line Tools for XCode 4.4
- export CC=/usr/local/bin/gcc-4.2 in bash_profile
- sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2
- edit: sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
I still get the following output when installing the json gem:
➽ gem install json -v '1.7.4'
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/Users/vincent/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
creating Makefile
make
/usr/bin/gcc-4.2 -I. -I/Users/vincent/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/x86_64-darwin11.3.0 -I/Users/vincent/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/ruby/backward -I/Users/vincent/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1 -I. -DJSON_GENERATOR -I/Users/vincent/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -O3 -Wall -O0 -ggdb -o generator.o -c generator.c
gcc-4.2: error trying to exec '/usr/bin/i686-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
make: *** [generator.o] Error 255
Gem files will remain installed in /Users/vincent/.rvm/gems/ruby-1.9.2-p320@hshmrk/gems/json-1.7.4 for inspection.
Results logged to /Users/vincent/.rvm/gems/ruby-1.9.2-p320@hshmrk/gems/json-1.7.4/ext/json/ext/generator/gem_make.out
Any help here? How can I debug my build env? Not an expert when it comes to this but I think the json gem installer is ignoring my environment as it's using a version of GCC that doesn't exist on my system and the brew installer doesn't create it either.
➽ gcc-4.2
i686-apple-darwin11-gcc-4.2.1: no input files
➽ which gcc-4.2
/usr/local/bin/gcc-4.2
➽ ls /usr/bin/i686-apple-darwin11-gcc-4.2.1
ls: /usr/bin/i686-apple-darwin11-gcc-4.2.1: No such file or directory
I also tried symlinking ➽ sudo link /usr/local/bin/gcc-4.2 /usr/bin/i686-apple-darwin11-gcc-4.2.1
. But that gave a vfork timeout error.
edit:
➽ brew doctor
gcc-4.2: error trying to exec '/usr/bin/i686-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
Warning: X11 is not installed.
You don't have X11 installed as part of your OS X installation.
This is not required for all formulae, but is expected by some.
You can download the latest version of XQuartz from:
https://xquartz.macosforge.org
edit2:
did run xcode-select XCode
edit3:
sudo xcode-select -switch /usr/bin
sudo ln -sf /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
This fixed it! Basically you tell OS X to compile using /usr/bin folder and then you link the llvm-gcc-4.2 compiler to where the old one used to be. Works! BAM!
source: http://jtimberman.housepub.org/blog/2012/02/26/xcode-command-line-tools/