Using the Installer Command


Similar to the graphical Installer utility, the command-line installer tool can also be used to install Mac OS X. The installer tool installs one package or metapackage per invocation. In the case of the metapackage, all packages in the metapackage will be installed unless disqualified by a package's check tool.

The command-line installer tool provides two main benefits over the traditional method of double-clicking a package to install it in the GUI:

  • You can install packages remotely via SSH. Copy the .pkg file to the remote machine, ssh into it, and run the installer tool remotely.

  • You can create scripts to automate package distribution and installation. These scripts could make use of other features of scripting languages to create complex tests and methods for package installation. You can use this method with both FireWire and DVD distribution techniques. Simply create a script that runs installer, and make it easily accessible or place it in the startup items.

To run the installer program, use the following command:

 installer [options] -pkg pathToPackage -target pathToDestinationVolume


where pathToPackage is the path to the package to install, and pathToDestinationVolume is the target volume. For example:

 installer -verbose -pkg /Users/Shared/master.pkg -target /Volumes/MacHD/


In this scenario, installer will install the package located at /Users/Shared/master.pkg to the hard drive mounted at /Volumes/MacHD/. With the -verbose option, installer displays output in a human-readable format rather than the default output, which is formatted for scripting. Type man installer on the command line for details on this option and several others.

One good way to determine whether a package can be installed on a computer is by using the installer command with the -pkginfo parameter. For example,

 installer -pkginfo -pkg myPackage.pkg -target /


In this case, installer will list the package or packages contained within the package myPackage.pkg that can be installed on the current startup volume (/). If for some reason the package can't be installed, it won't be listed. Add this command to a conditional statement in a custom script to verify that a package can be installed before attempting to perform the installation.




Apple Training Series(c) Mac OS X v10. 4 System Administration Reference
Apple Training Series: Mac OS X v10.4 System Administration Reference, Volume 2
ISBN: 0321423151
EAN: 2147483647
Year: 2006
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net