System vs. Target in PackageMaker
The PackageMaker user guide doesn’t explain the difference between “system” and “target” in PackageMaker’s pop-up of Requirement criteria:
So now that I’ve figured it out, I’ll fill in the gap for you.
- System is the volume that the installing user is booted from.
- Target is the volume that the Requirement is testing. (Your Requirements are applied for each volume.)
So if you want to make your Installer package installable to any bootable volume, make it installable to any volume and add a Requirement for Target OS Version. (Another method you may try is “File Exists on Target: /Library”.)
If, on the other hand, you want to make your Installer package installable to the Home folder, make it installable only to the Home folder and add a Requirement for System OS version.
How you can get this wrong
If you make your package installable to the Home folder but test the Target OS Version, your package is broken: It does not work for those of us who have our Home folder on a non-bootable volume (in my case, separate from two other, bootable volumes). You must use the System OS Version, and hope for the best.
If you make your package installable to any volume but test the System OS Version, your package is broken: The user will be able to install your software to a volume whose version of the OS cannot run it. You must use the Target OS Version.
As far as I know, there’s no way to make a package that does both properly, since the choice of any volume, booted volume only, or Home only is per-package, not per-choice or per-contents.
Dramatic twist ending
The above is good if you’re targeting Leopard. If you still support Tiger, there’s a twist. (Obligatory video link.)
GrowlMail is a good example. As a Mail bundle, it requires a couple of user-default settings to work. That makes installing to /Library pointless, because the settings will only be set for the user who installed it, so it won’t work for any other users on the system.
Leopard allows installing to ~, so that’s easy: I use System OS Version, as I suggested above.
But Tiger’s Installer can’t install to ~. The same Installer package that works on Leopard does not work on Tiger (I even tested with earlier betas—it has never worked in any 1.1.6 beta). I don’t know how nobody noticed this, not even our Tiger testers.
The Installer package for Tiger must target /Library, since I can’t do the proper thing on that OS version, so I must make separate GrowlMail packages for Tiger and Leopard.
- The Leopard package installs to ~/Library and uses System OS version, as I suggested above.
- The Tiger package installs to /Library and uses both Target OS Version and System OS Version:
- If the user is running on 10.5 or later (System OS Version ≥ 10.5.0), the package tells them to use the other package. (The other package has a similar check.)
- If a destination volume does not have 10.4 or later installed on it (Target OS Version < 10.4.0), the package tells them they can’t install there.
This is what you’ll find in Growl 1.1.6b4 and 1.1.6 final. It’ll go away in 1.2, since we’re dropping Tiger then.
July 26th, 2009 at 03:36:50
The way we get around this in the ClickToFlash installer is to install to /tmp, and then have a post-install script that moves the files from /tmp to ~/Library/Internet Plug-ins/. You could probably do something similar for Growl, although it might be more effort than it’s worth if you’re going to end up dropping Tiger soon anyway.