Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 925
Jody G Avatar asked Jun 16 '12 12:06

Jody G


2 Answers

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.

like image 175
KleverKrypto Avatar answered Nov 18 '22 17:11

KleverKrypto


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

like image 3
Jody G Avatar answered Nov 18 '22 17:11

Jody G