For some reason today I could no longer install ruby gems.
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile
make
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -Wall -funroll-loops -c yajl.c
Error: No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path.
make: *** [yajl.o] Error 1
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/yajl-ruby-1.1.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/yajl-ruby-1.1.0/ext/yajl/gem_make.out
I tried nuking rvm, reinstalling the command line tools, installing a separate GCC compiler, etc. Nothing worked.
The problem was that I had uninstalled XCode.app a while back when Apple released their official standalone Command Line Tools. Evidently there are still a few makefiles that reference some of the XCode.app components such as xcrun (don't even know what it is).
I was worried that I was going to have to reinstall the behemoth XCode.app, just to satisfy this ruby crap, but the folks over at stackoverflow figured out that you can replace xcrun with your own local shells script that simply calls the given arguments like so:
#!/bin/bash
$@
I dropped it in ~/bin (which was already in my PATH) and made it executable, then opened a new terminal window and tested it:
$ which xcrun
which returned
/Users/zachharkey/bin/xcrun
And now I can install ruby gems again.
Note: Add the following line to .bash_profile to add ~/bin to your PATH
export PATH="$HOME/bin:$PATH"