If you don’t really need Xcode, but all you need are the Xcode command line tools, here’s how to install them on Snow Leopard.
Simply download the “Command Line Tools” package from Apple Developer (free account required; you can use your Apple ID). As of this writing, the package is named “Command Line Tools for Xcode - Late March 2012”. It’s a 171.70 MB disk image, which pales in contrast to the 4+ GB full Xcode download.
Note that, if you’ve already installed Xcode, you’ll want to uninstall it before installing the Command Line Tools.
Once you’ve downloaded the package, launch Terminal.app and type:
cd /Volumes/Command\ Line\ Tools
cp -r * ~/osx-gcc
mv Command\ Line\ Tools.mpkg pkg/install.mpkg
xar -xvf install.mpkg
Note: It’s important that you use
cp -r, rather than simply
cp; the former will copy all hidden installation files to the
~/osx-gcc directory. The
Command Line Tools.mpkg file is merely a 512 KB descriptor that contains the installation instructions; the actual packages are located in the hidden, aptly-named
Next, open the
Distribution file with your favorite text editor. I prefer TextMate (
mate Distribution), but you can use
emacs, BBEdit, TextWrangler, or even TextEdit (
open -a TextEdit Distribution). On the tenth line, you should see the following:
var majorOSVersion = '10.7';
This specifies the minimum operating system requirement — OS X 10.7 Lion, in this case. Change
'10.6', save the file, and close your text editor. You’ve now modified the package so that it will install successfully on Snow Leopard; the final step is to recreate the package file so that it can be read by the installer app:
xar -c . -vf ../install.mpkg