Coding Range

Installing Ruby Gems on OS X

November 15th, 2012

I’ve been considering playing around with CocoaPods for a while. I finally got around to it, only to discover it won’t install. If you get this error message while running ‘gem install’:

Building native extensions.  This could take a while...
ERROR:  Error installing cocoapods:
    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/xcodeproj-0.3.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/xcodeproj-0.3.5/ext/xcodeproj/gem_make.out

just make sure you have the Command Line Tools for Xcode installed. They can be installed either through Xcode 4.3+, or as an independent package from  Developer