Matt Long
Matt Long

Reputation: 24466

Custom Mac Installer Overwrite /Library/Application Support File

My installer places a file into /Library/Application Support/AppName. As a final step of the install process in a custom installer plugin (Objective-C code) I check for a more recent version of that file. If it exists, I download it and then attempt to overwrite the one created by the installer. The issue is that I apparently don't have permission to overwrite. Shouldn't the installer plugin that is part of the installer have permission to overwrite that file since the user was prompted for an admin password already?

Any ideas on how I can write to the /Library/Application Support/AppName directory from my installer plugin?

Upvotes: 1

Views: 1540

Answers (1)

Rob Keniger
Rob Keniger

Reputation: 46020

I believe that Installer actually uses a privileged helper tool to do the installation. The Installer app itself doesn't get admin privileges, which is why your plug-in doesn't have admin privileges.

The Apple docs explain one way to handle a privileged installation, although the BetterAuthorizationSample code is the "best" way to do it.

Unfortunately, handling privileged operations is quite tricky and you should study and understand the sample code and the Authorization Services documentation before implementing anything.

Upvotes: 1

Related Questions