10

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

Jody G
  • 583
  • 8
  • 21
  • Maybe you should take a look at this: http://stackoverflow.com/a/761755/1454769 – David Jun 16 '12 at 13:02
  • Thanks, I looked at that but I had already installed command line tools and can't get non llvm gcc for Mountain Lion. I even tried downloading from source and building non-llvm gcc. – Jody G Jun 16 '12 at 14:36

5 Answers5

9

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.

KleverKrypto
  • 518
  • 4
  • 14
  • 1
    Thanks. I had already installed command line tools although I'm not sure if it was from xcode 4.4 or 4.3. Fast forward a few weeks and I'm now up and running on Mountain Lion. Once it left beta, it just worked. – Jody G Jul 30 '12 at 16:01
  • 1
    I am currently on Ruby 1.9.3p194 and experienced this issue after upgrading to Mountain Lion. Dwight's solution worked perfectly for me, after installing the Command Line Tools for XCode 4.4.1, all native gems had no issue building when installing gems. Thanks Dwight! – Dom Aug 08 '12 at 14:58
  • 1
    Had a similar problem installing the gem gollum in OSX 10.8.2, with Ruby 1.9.3. Installing the Command Line Tools for XCode 4.6 did solve the problem. Thanks – Giuseppe Mar 07 '13 at 07:52
3

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

Jody G
  • 583
  • 8
  • 21
1

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

Ivo Dancet
  • 191
  • 2
  • 5
1

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.

Matt Turner
  • 65
  • 1
  • 5
  • downloading the newest CLT worked for me - mountain lion, oct 2012 – ina Oct 08 '12 at 06:05
  • I am running on a brand new machine with OS 10.8.2, I downloaded the latest command line tools (xcode452cltools10_86938211a.dmg), I upgraded to ruby 1.9.3p327 via RVM, set xcode-select to /usr/bin, and I am still getting this problem. Currently downloading the full developer tools… – jongala Dec 21 '12 at 05:52
1

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