As you explore open-source Mac software, you will eventually have to build for older versions of OS X.
But you will need older OS X SDKs.
The solution? Roundhouse-kick an old, defenseless Xcode installer into a bloody mess, of course! Then you can find all its subinstallers—including the legacy SDKs!
The easy way is to use Pacifist (shareware $20), which is a great piece of software designed to do exactly this sort of thing. If the Terminal scares you, I highly recommend it!
But, if you are a Terminal junkie, here is how I added the SDKs for 10.6 and 10.7, using only free software. The technique can really be applied to any .pkg installer.
Mac OS X 10.6 and 10.7 SDKs
- Download "Xcode 4.2.1 for Lion" from https://developer.apple.com/downloads and mount the disk image.
- Now switch to the Terminal. From now on, commands inline with the paragraph text are optional and commands indented in code blocks are required.
If you run file /Volumes/Install\ Xcode/InstallXcodeLion.pkg, you will see that the installer is a xar archive. To unpack it, runcd ~/Desktop mkdir Xcode421 cd Xcode421 xar -xf /Volumes/Install\ Xcode/InstallXcodeLion.pkg
- Now, run
cd InstallXcodeLion.pkg
- Running ls -lh shows that Payload is the largest file. If we again run file Payload, we see that we have a gzip archive, which is in fact a tarball. Unpack it with
mv Payload{,.tar.gz} tar -xf Payload.tar.gz
- Now run
open Applications/Install\ Xcode.app/Contents/Resources/Packages
- Run MacOSX10.7.pkg, MacOSX10.6.pkg, then MacOSX10.6.Patch1.pkg from the Finder. (Hint: If you keep a previously-authenticated installer open after it completes, you can run the next installer without a password.)
(Updated 28-11-2014:) If the system complains about the .pkg being from an unrecognized developer, you can open it anyway by right-clicking, and selecting open. This will give a different warning dialog, in which you have an "Open" button. - Back in the Terminal, run
cd /Applications/Xcode.app/Contents/Developer/Platforms/ sudo mv /SDKs/*.sdk MacOSX.platform/Developer/SDKs/
Mac OS X 10.5 SDK
The older installers are a bit simpler. I think that this is because they didn't need to be packaged for the App Store like the new ones. Without further ado, we'll Chuck Norris this one too!- Download "Xcode 3.2.6 and iOS SDK 4.3 for Snow Leopard" from https://developer.apple.com/downloads and mount the disk image.
- Still in the Finder, with the window for the disk image in the front, hit Cmd-Shift-G and type "Packages" in the box.
- Double-click and install MacOSX10.5.pkg.
- In the Terminal, run
cd /Applications/Xcode.app/Contents/Developer/Platforms/ sudo mv /SDKs/MacOSX10.5.sdk MacOSX.platform/Developer/SDKs/
Bonus: Hiding and un-hiding files
That was pretty sneaky of Apple, hiding the Packages folder like that. If you want to be able to do that too, add these lines to your .bashrc:alias hide='sudo chflags hidden' alias unhide='sudo chflags nohidden'
PS: Older .pkgs (added 28-11-2014):
For even older SDKs, the installer might get in your way, since your system is too new. The answer is to Chuck Norris it some more.- Copy the .pkg to a writeable location.
- Right-click and open the package contents.
- Go to Contents/Resources.
- Move VolumeCheck to the Trash.
- Right-click on the .pkg, and click Open. This lets you open it despite the package not being signed.
No comments:
Post a Comment