Xcode 4 and Snow Leopard
Solution 1:
If you have registered for the paid iOS developer program, you should be able to see Xcode 4.2 for Snow Leopard available in the iOS Dev Center.
Here's what I see from a paid account:
Here's what I see from a non-paid account (there's no Xcode 4.x for Snow Leopard):
This also explains why Xcode is a paid download in the Snow Leopard App Store, but is free in the Lion App Store.
Solution 2:
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
mkdir osx-gcc
cd /Volumes/Command\ Line\ Tools
cp -r * ~/osx-gcc
cd ~/osx-gcc
mkdir pkg
mv Command\ Line\ Tools.mpkg pkg/install.mpkg
cd pkg
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 Packages
directory.
Next, open the Distribution
file with your favorite text editor. I prefer TextMate (mate Distribution
), but you can use vi
, 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.7'
to '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:
rm install.mpkg
xar -c . -vf ../install.mpkg
cd ..
open install.mpkg