I'm in the process of porting our installer from PackageMaker to pkgbuild and am trying to make the default install location be the current user's home directory and still allow the user to install system wide.
In my distribution file I have enable_currentUserHome="true" and enable_localSystem="true" which correctly allows the user to "Install for all users of this computer" or "Install for me only". However, I'd like for "Install for me only" to be selected by default.
pkgbuild has a command line option for "--install-location" which the man page says specifies the default location, but there's no mention of how to specify the home directory. I've tried "~" and "$HOME" with no luck. Is there some macro I don't know about?
Does anyone know how to tell pkgbuild to install under the current user's home directory by default?
Thanks in advance!
-Owen
pkgbuild generates the component package for you. Although a component package can be installed on its own, it is typically incorporated into a product archive. In the product archive you can set the install domain like localSystem and home.
For example pkgbuild --install-location /Application
would install it as expected into /Application if the local system domain is chosen, or into $HOME/Application if the home installation is chosen.
That said, I highly discourage form using the Installer for home folder installation. It's just not working in the real world.
See my Known Issues and Workarounds
section in Making OS X Installer Packages and also Installer Problems and Solutions.
One workaround is to set the distribution file params like this:
enable_localSystem="false"
enable_anywhere="true"
enable_currentUserHome="true"
The home installation will be chosen by default as it is the first choice enabled.
Users will be still allowed to install it system wide by selecting Install on a specific disk...
-> Macintosh HD
.
The drawback: it is less easy for the user than choosing directly: Install for all users of this computer
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With