Installation Q & A
I want to install items in the current user's home directory (a.k.a. ˜/). How can I do that?
This is a supported feature of the distribution script format. It can be achieved pretty easily.

This article will describe how to do this with Packages.

There are two things you need to know before we look at the details:

  • You can not install items both in the current user's home directory and outside it. This is not supported by the distribution script format.
  • This requires Packages version 1.1 or later.


Let's say you want to install a file in ~/Library/Application Support. Here's how to do that:

  1. Open Packages
  2. Create a new Distribution project.
  3. Choose Packages > Preferences…
  4. Click Advanced.
  5. Check Show Advanced User Options and close the Preferences window.
  6. Select Project in the source list.
  7. Click the Settings tab.
  8. Scroll to the bottom of the Advanced Options list.
  9. Check current user's home.
  10. Click the Requirements & Resources tab.
  11. Check Install on startup disk only.
  12. Select the package in the source list.
  13. Click the Settings tab.
  14. Uncheck Require admin password for installation.
  15. Click the Payload tab.
  16. Select the /Library/Application Support row in the Contents list.
  17. Click +.
  18. Select the file you want to install and click Add…
  19. Select the Reference Style and click Add.

You can now build your package and test it.

You don't have to worry about the owner and group of the file, it will be set to the current user's id and group upon installation.

Sample Project

Bonus Track: Possible workarounds for Apple bugs

There is a well known issue in Apple's when it comes to the "Current User's Home" domain:

Depending on the weather conditions, will not correctly select or detect the domain.

First launch of the distribution.

Second launch of the distribution.

Tip: If you're facing this issue, just click on the "Install for me only" row. You will then be able to click the Continue button and proceed with the installation.

This issue has been in for close to a decade and has been reported to Apple multiple times. It could either be a bug in or an error in the Distribution XML documentation. Based on the lack of feedback or fix till now, let's just assume that this is yet another Apple's SNAFU.

Meanwhile, the installer command line tool works fine when using the -target CurrentUserHomeDirectory option.

There are at least 3 possible workarounds for this quite annoying issue:

  • require your user to install the distribution through Which is not very user friendly.

  • develop a small application wrapper to embed the distribution and invoke the installer command with the -target CurrentUserHomeDirectory option through a NSTask or a system(3) call. See the AppWrapper sample project below (Obj-C and Swift Xcode projects).

  • install the distribution through another distribution. This is the workaround that will be detailed below.

What we need to do is to:

  1. Open Packages.
  2. Create a new distribution project.
  3. Select the package of the distribution.
  4. Add a post-installation script to install our real distribution as the current user.
  5. Add our real distribution to the Additional Resources of the package of the distribution.
  6. Build.
The script would look something like this:

/usr/bin/su $USER -c  "/usr/sbin/installer -pkg ./RealPackage.pkg -target CurrentUserHomeDirectory"

exit 0

Et voilà ! It's possible to automate the creation of the 2 distributions using a shell script as in the Q&A-03_PackageLockdown sample project below.

  • Pro: this does not require to create an additional application, codesign it (and notarize it).
  • Cons: this workaround will require the user to enter an admin password.

Sample Projects

Site Map

Copyright 2012-2020 Stéphane Sudre. All rights reserved.