blog advertising is good for you


blog advertising is good for you
User login

Software Update and Package Installation From the CLI

For those of you that didn’t know (and it’s an honest omission of knowledge) Apple’s Installer and Software Update tools have CLI tools that do their dirty work for them, and you can use them to remotely administer your machine (or do so more directly than the GUI lets you).

The Installer’s CLI command is, shockingly, installer. The basic syntax is:

$ installer -pkg GoshIHopeItsNotATrojan.pkg -target /

You can also have a little fun with it with its myriad options.

Software Update is similarly called softwareupdate and you can get a list of suggested updates with:

$ softwareupdate -l

Or install all pending updates with:

$ sudo softwareupdate -i -a

It, too, has a manual page that talks about its options. Be aware that for any install for which the GUI would request authorization (pretty much any update), you’ll need to run this as root during the install. You can, however, list and download updates as any user.

Note that, unlike the GUI, this tool does not check for already-downloaded updates when installing. Thus, if you told it softwareupdate -d -a to download all updates and then softwareupdate -i -a it would not use the package cache at /Library/Packages but would download them instead.

To use the package cache, issue the command to have softwareupdate download all packages and then do something like this:

$ for FILE in /Library/Packages/*pkg; do sudo installer -pkg $FILE -target /; done
Average rating
(1 vote)
About Adam Knight
Adam Knight's picture

Author Biography

Adam Knight is one of the founders of Mac Geekery and is a geek at heart. Programmer by day, hacker by night, his daily life revolves around the Macintosh platform, which he has been a user and programmer for since the early days of System 7 when his LCII replaced his Apple //c.

In-between tech jobs, he’s managed to learn the basics of any web hacker: PHP, MySQL, Perl, Apache, Linux, *BSD, and the intricacies of ./configure —prefix=~/bombshelter/. Today, codepoet is concentrating on blogging again, writing some software for the Mac by himself (including Notae) and for his company (such as Switchblade) and has a few other toys coming out soon.

Bug him over AIM or email [link fixed].

Post new comment
The content of this field is kept private and will not be shown publicly.
1 + 5 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.