Apple uses its App Store as a mechanism to distribute software, and it works quite well when a human operator is available to interact with it.
Unfortunately, many configuration management tools (e.g. chef, puppet) can’t interact with the App Store, but they can interact with MAC OS X installer packages (.pkg, .mpkg files). We’ll show you how to extract the underlying installer package file from the App Store.
This was tested under OS X 10.8.1 installing the OS X server package. It may not work for other packages.
Bring up the App Store, find the package you would like to install, install it, and as soon as it starts downloading, jump to a terminal window and stop the installd daemon by sending it a STOP signal:
sudo killall -STOP installd
Find out where the package file was downloaded to using the lsof command:
sudo lsof | grep storeagen | grep pkg
The pathname should be a long and fairly random string, similar to “/private/var/folders/83/5wx556bd59zbj0n2j0w7kjyc0000gn/C/com.apple.appstore/537441259/mzm.unntdyyb.pkg”. You’ll need to move that file to the appropriate location.
mv /private/var/folders/83/5wx556bd59zbj0n2j0w7kjyc0000gn/C/com.apple.appstore/537441259/mzm.unntdyyb.pkg ~/os_x_server.pkg
Now that we’ve moved the package to a safe place (and inadvertently pulled the rug out from under the installd daemon), we’re ready to let the installd daemon continue and generate an error message:
sudo killall -CONT installd
Ignore the error message about a failed install.
The package would be subsequently installed by using the installer command, e.g.:
sudo installer -pkg ~/os_x_server.pkg -target /
About the AuthorMore Content by Brian Cunnie