Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Prior to Mountain Lion, I was able to install packages with /usr/sbin/installer as an Admin user. However, with Mountain Lion, when I try running

installer -pkg blah.pkg -target /

I get the error

installer: Must be run as root to install this package.

I've monkeyed with the IFPkgFlagAuthorizationAction variable in the package's info.plist, setting it to AdminAuthorization and even UserAuthorization, but that doesn't seem to have any effect.

I can install with sudo to actually run as root, but the software (correctly) expects me to install as a non-root users and thus doesn't work.

If I use the GUI Installer.app on the same package (even without modification to IFPkgFlagAuthorizationAction), I am prompted for an Admin—not root—password and everything works as expected.

How do I get the behavior of the GUI tool from the command line?

share|improve this question

1 Answer 1

I ran into the same issue today. ;)

I can't help you run the installer as root while giving the installed files the ownership of a regular user, but you should be able to change the ownership after the install to get the same effect and ultimately get around this restriction.

If, for example, your user account is "myusername" and you have a group such as "_developer" that is a better owners group for the application you are installing, you could reset the ownership after install via something like:

sudo chown -R myusername:_developer ~/Library/[MYAPPNAME]
sudo chown -R myusername:_developer ~/Library/Application\ Support/[MYAPPNAME]

It seemed to work in my situation. Might help you, too. Of course, paths and user/group names would be particular to your situation. :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.