Installing Command Line Tools for Lion on Snow Leopard
I've encountered many programs which won't just install on my Mac, so I decided to find out how to install them.
One way is to just extract the installer and install the packages straight from there, but then the scripts won't run and this is horrible pain with big installations.
*.mpkg files usually have a file called "Distribution" inside. That file is just simple XML script, which tells the installer where the software can be installed.
By editing the Distribution file, you can easily get OS X 10.8 install on an AMD machine, but of course it won't run because of the kernel. Another example is XCode's Command Line Tools.
I only found CTL for Lion available in the Apple Download Center, so I decided to patch it for SL.
I tried with Flat Package Editor (comes with XCode), but it couldn't save the file, so I did it the manual way:
First I created an copy of the DMG file with Disc Utility, to make it writable.
Then I executed few commands:
bash-3.2# cd /Volumes/Command* bash-3.2# mkdir patch bash-3.2# cp Command* patch bash-3.2# cd patch bash-3.2# mv Com* CTL.mpkg bash-3.2# xar -x -f CTL.mpkg
Then I opened Distribution with TextEdit:
Well, well, well... Look what we got there
var majorOSVersion = '10.7'; var lessThanOSVersion = '10.8';
So, I just changed the majorOSVersion to 10.6 and voilà!
Sometimes the script is a little more complicated (like the OS install script), which checks for supported machines, 64/32-bit, etc.
Then you will just need to edit some functions output to true or otherwise just find a way around the checks.
The language used in Distribution file is very easy to understand in my opinion, it can require a little bit of coding knowledge though.