gem update fails – can’t find header files for ruby

So, Pat got a new MacBook Pro. Little does she know, I’ve start to install programs that I would use if I just so happened to be on her computer. The laptop already had Leopard installed and all of its goodies but a bit of upgrading was called for. So, of course I had run gem update.

pats-macbook-pro:~ pat$ sudo gem update

Updating installed gems

Updating RedCloth

Building native extensions.  This could take a while...

ERROR:  While executing gem ... (Gem::Installer::ExtensionBuildError)

    ERROR: Failed to build gem native extension./System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb update

can't find header files for ruby.

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/RedCloth-4.0.3 for inspection.

Results logged to /Library/Ruby/Gems/1.8/gems/RedCloth-4.0.3/ext/redcloth_scan/gem_make.out

But then I ran into a strange error I had never seen before. gem update would fail when trying to build native extension. It’s been awhile since I setup a rails development environment so a-googlin’ I went.

Turns out 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!

gem update fails – can’t find header files for ruby

5 thoughts on “gem update fails – can’t find header files for ruby

Leave a Reply

Your email address will not be published. Required fields are marked *