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:
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. |