25

Apple suggests that prior to submitting to the Mac application store, the installation process for Macs be tested using the command

sudo installer -store -pkg path-to-package -target /

I saved the application package to the desktop and then in the terminal I sent the command

sudo installer -store -pkg /User/MyName/Desktop/helloWorld.pkg -target /

From the above command I get this

installer: invalid option -
Usage: installer [-help] [-dominfo] [-volinfo] [-pkginfo] [-allow] [-dumplog]
                 [-verbose | -verboseR] [-vers] [-config] [-plist]
                 [-file <pathToFile>] [-lang <ISOLanguageCode>] [-listiso]
                 [-showChoicesXML] [-applyChoiceChangesXML <pathToFile>]
                 [-showChoicesAfterApplyingChangesXML <pathtoFile>]
                 -pkg <pathToPackage>
                 -target <[DomainKey|MountPoint|DiskIdentifier|DeviceNode|UUID]>

I am very new to the Terminal. What does this mean and how do I fix it so that I can install the application as suggested by Apple?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
David
  • 14,205
  • 20
  • 97
  • 144

2 Answers2

33

Probably not exactly your issue..

Do you have any spaces in your package path? You should wrap it up in double quotes to be safe, otherwise it can be taken as two separate arguments

sudo installer -store -pkg "/User/MyName/Desktop/helloWorld.pkg" -target /
Ben
  • 20,737
  • 12
  • 71
  • 115
  • I copied the command from the Apple doc to a note pad and for some reason that changed the spaces in between the commands. So the problem was "- store" when it should be "-store". Thanks for the help. – David Dec 08 '10 at 05:27
  • This command prompts for a admin password, is there any way to do it without that, or a option to pass the password in the same command... something like sudo -password ****** – Jinith Mar 14 '11 at 13:52
  • @Ben Thanks, it worked. But i want to pass some argument with this shell command. And i want to get this argument inside installation script in package installer . Any possibilities? – santhosh Feb 04 '15 at 12:50
  • @santhosh post a new SO question – Ben Feb 04 '15 at 21:38
  • @Ben Posted the new question: http://stackoverflow.com/questions/28325244/how-to-pass-arguments-to-package-installer-from-mac-terminal – santhosh Feb 05 '15 at 05:34
0

To disable inputting password:

sudo visudo

Then add a new line like below and save then:

# The user can run installer as root without inputting password
yourusername ALL=(root) NOPASSWD: /usr/sbin/installer

Then you run installer without password:

sudo installer -pkg ...
Moses
  • 56
  • 4