4

I'm running OS X Mavericks, with Rails 3.2.12. When I try to do rails new project, it gets stuck at bundle install.

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb creating Makefile make compiling generator.c make: gcc-4.2: No such file or directory make: *** [generator.o] Error 1 Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/json-1.8.1 for inspection. Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/json-1.8.1/ext/json/ext/generator/gem_make.out An error occurred while installing json (1.8.1), and Bundler cannot continue. Make sure that `gem install json -v '1.8.1'` succeeds before bundling. 

I get the same error when I do 'gem install json....' as it suggests. I've installed the latest version of Xcode, with the command line tools. When I do:

which gcc 

I get:

/usr/bin/gcc 

I'm new to all this stuff really, so please try to keep things simple.

1 Answer 1

7

So, prior to XCode 5, there was a gcc-4.2 binary, which got removed in the upgrade.

I found this tutorial helpful in getting gcc-4.2 back and running with ruby. It assumes that you're using homebrew to manage packages on your Mac.

Sign up to request clarification or add additional context in comments.

2 Comments

the first link you shared, helped me a lot. Thanks.
Hi,I was getting exactly same error related to json on rails 4 on windows. I didn't hear about this xcode. Is it something related to MACOs? I couldn't decide if installing it on windows will fix my problem too ??

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.