tags:

views:

2206

answers:

5

I need to install the JSON gem to start my app but I get the error below whenever I try to install the json gem. Can anyone help me out. Im using rails 2.2.2 and gems 1.3.1; thx for any help you can provide.

Arions-macbook-pro:.ssh arion$ sudo gem install json
Password:
Sorry, try again.
Password:
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 install json
can't find header files for ruby.


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

Have you installed ruby-dev ?

LB
How do you install ruby-dev on a mac? is it a port or a gem or something like that?
+3  A: 

You are missing the ruby development headers. To install these on an OS like ubuntu you should use:

aptitude install ruby1.8-dev
neomorphic
Im using a mac... do I still just need to install ruby-dev?
yes, you need ruby-dev
Palesz
+4  A: 

The ruby headers don’t come installed with the base ruby install with Mac OS X. These can been found on Mac OS X Install Disc 2 by installing the XCode Tools.

Once installed, all was well!

+2  A: 

Installing XCode tools... should fix this issue.

p01nd3xt3r
+1  A: 

A simple google search (http://www.google.com/search?rls=en-us&q=can't+find+header+files+for+ruby) reveals this:

If you get the can't find header files for ruby error message when trying to build an extension or a gem, it means that Ruby cannot locate its header files.

Header files are not delivered by default with Mac OS X, you need to install the Xcode Tools package after the installation. You can find it in the Optional Installs / Xcode Tools directory on the Leopard DVD.

Janco