Chris Contolini

Installing Ruby development headers on Mac OS X Lion

$ 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

If you’re running Mac OS X and you run into the error above about a lack of Ruby header files, click over to the OSX GCC Installer page and download the appropriate .pkg file. Run it and you’ll have all the necessary dev tools.

The latest version of XCode does not include ruby-dev.