Mac Installer package (productbuild) asks for admin password, but shouldn't

959 views Asked by At

I've created an pkg installer package with productbuild in the way:

$ productbuild --component "/Applications/Earlybird.app" /Applications --sign "Developer ID Installer: Name" --product "/Applications/Earlybird.app/Contents/Info.plist" Thunderbird_14.0_enUS.pkg

This has worked just nice. But if I try to install the application it asks for the admin password. But it does not need it for a simple application. This will confuse the user. So I've tried to solve this by opening the pkg with Flat Package Editor and change the auth="root" in the PackageInfo file to auth="none". But it still asks for the admin password. Why is this and how can I solve it? I'm on OS X 10.8. Thanks!

2

There are 2 answers

0
andi Titu On

I achieved what op wants by editing the Distribution.xml file to contain the following: <domains enable_anywhere="false" enable_currentUserHome="true"/> (on MacOS 13.5)

Official reference is not too clear about it:

Required. If true, or a JavaScript expression that evaluates to true, the product can be installed into the current user’s home directory. Otherwise, it cannot be installed in the current user’s home directory. A home directory installation is done as the current user (not as root), and it cannot write outside of the home directory. You should enable this only if the product can be installed in the user’s home directory and be completely functional from that location.

What this actually means is that you are the software will only be installed for the current user, and other user won't be able to use that software. So no system password will be required.

You can quickly test the above by performing the following on your created .pkg:

  • pkgutil --expand Thunderbird_14.0_enUS.pkg ./tmpdir
  • edit the Distribution.xml from ./tmpdir
  • pkgutil --flatten ./tmpdir Thunderbird_14.0_enUS.pkg

(To allow the user to customise the location where the app can be installed set the following in Distribution.xml: <choice id="1" ... customLocation="/Applications">, this will also provide /Applications as default but allow customisation)

auth="none".

This is documented as deprecated.

0
paulmelnikow On

On a Mac, you need administrative access to write to /Applications.

There isn't a way around this, except to copy the app to the user's home folder instead.