Tuesday, March 3, 2009

Installing Mac OS X software updates from the commandline

I don't know why I didn't know this existed earlier - it's the most helpful computer administration command I've found in a year.

Apple's Software updates can be downloaded and installed on Mac OS X with the command "softwareupdate". This makes Updating your OS X remotely via ssh a snap compared to using ARD or VNC.

The command:

softwareupdate -l

will scan the apple update site for pending updates, and display them complete with a commandline-friendly label (name).

You can then install the updates you want with

softwareupdate -i [update_label]

For example:

$ softwareupdate -l
Software Update Tool
Copyright 2002-2005 Apple

Software Update found the following new or updated software:

   * JavaForMacOSX104Release7-1.0
      Java for Mac OS X 10.4, Release 7 (1.0), 82580 [recommended]

$ softwareupdate -i JavaForMacOSX104Release7-1.0

The command output shows which upates are recommended and which will requite a system restart.

The install command prints out a handy character based progress meter while it's downloading and installing:

Downloading Java for Mac OS X 10.4, Release 7
 Downloading Java for Mac OS X 10.4, Release 7

 Expanding Java for Mac OS X 10.4, Release 7
 Installing Java for Mac OS X 10.4, Release 7


This is one terrific feature!

1 comment:

Anonymous said...

Thanks for posting this, first result on my google search and exactly what I was looking for!