Jody G
Jody G

Reputation: 583

Trouble installing json gem on mountain lion

I tried running bundle install and it stopped on the json gem. So I tried running running sudo gem install json 1.7.3 which is the version that it crashed on it it gave the following:

unknown109addaae0a6:introhive Jody$ sudo gem install json
Building native extensions.  This could take a while...
ERROR:  Error installing json:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.7.3 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.3/ext/json/ext/parser/gem_make.out

Then if I look at the gem_make.out file it looks like this:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

I've tried making sure command line tools were installed, but I'm at a bit of a loss on how to get by this one.

Any help would be appreciated. Thanks

Upvotes: 10

Views: 8534

Answers (5)

Dennis Connolly
Dennis Connolly

Reputation: 71

I too had the same error message when trying to install Ruby On Rails on a Mountain Lion 10.8.2 system with Xcode 4.6.

A ruby version 1.8.6 is part of the normal OSX installation. After installation the command line tools in Xcode; as posted by Dwight Scott in this thread:

*launching Xcode then clicking Xcode > Preferences > Downloads and click install next to command line tools.*

The solution worked:

*<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
 >= 1.9.2 : nothing to do! Yay!
Successfully installed json-1.7.6
Successfully installed rdoc-3.12.1
Successfully installed railties-3.2.11
Successfully installed bundler-1.2.3
Successfully installed rails-3.2.11
5 gems installed*

Thanks Dwight

Upvotes: 1

Matt Turner
Matt Turner

Reputation: 65

It looks like Apple updated the Developer tools this month (August 2012)

I was hitting this problem and I just downloaded the latest Dev tools from https://developer.apple.com/downloads/index.action and now everything works.

Upvotes: 1

Ivo Dancet
Ivo Dancet

Reputation: 191

Upgrading from 1.9.3-p125 to 1.9.3-p194 did it for me.

Upvotes: 1

KleverKrypto
KleverKrypto

Reputation: 518

I was having a similar problem installing JSON 1.7.4 except I'm using RVM. Anyhow, what I did to remedy my problem was install Xcode 4.4 from developer.apple.com and once that was installed I had to install Xcode's command line tools. You can install the command line tools by launching Xcode then clicking Xcode > Preferences > Downloads and click install next to command line tools.

Upvotes: 9

Jody G
Jody G

Reputation: 583

I eventually had to go to ruby 1.9.2 in order to make it work.

Upvotes: 3

Related Questions