Unable to install gem on mountain lion?


I’m trying to install a specific gem but getting this error message below.

ERROR: Error installing nokogiri:
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/nokogiri-1.5.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/nokogiri-1.5.5/ext/nokogiri/gem_make.out

I’ve seen that some folks have resolved this issue by reinstalling the new version of x-code. Which I did - but no avail.

Any tips?


In new versions of XCode you need to specifically install the command line tools for this to work.

Check here for a screenshot of how to:


Hm… Interesting. I went and installed the extra extension into xcode. but now getting a different output.

Ah…fixed with homebrew and these instructions here.