How to apply OS X software updates from the command line
Apple's Software Update is a convenient and easy way to keep your Mac up-to-date with the latest security fixes and feature enhancements. To make the service user-friendly, it's been available as a simple graphic-based tool in the Apple menu, but in recent versions of OS X Apple has integrated this service with its Mac App Store. Though it's convenient for most people, if you do not wish to open the Mac App Store for managing updates, there's a way you can avoid it.
Unfortunately there is no known way to revert the Software Update service from the Mac App Store to the old Software Update utility. Even though the old Software Update exists in Mountain Lion's /System/Library/CoreServices/ directory, when launched the system will instead defer to the Mac App Store. Apple also prevents you from removing or modifying the App Store application, but if you do manage to do so, then unlike older versions of OS X such as Snow Leopard, in which system services would revert to their older implementations without the presence of the store, in Mountain Lion the services simply become unavailable. As a result, if you delete the store, the system will not provide a means to apply system updates.
If you don't want to use the App Store for applying updates to your system or if the store is giving you errors, there is another approach: use the softwareupdate command in the Terminal. In most versions of OS X, Apple included this command to help manage systems remotely without having to use screen-sharing services. By logging into a system using the command line, you could keep it up-to-date by running the softwareupdate command.
To get a full synopsis of the command and its uses, you can run "man softwareupdate" in the Terminal to see the Unix manual page for the command, or you can run the command itself to get a brief usage output summary:
In basic usage, you need to be logged in as an administrator, after which you can open the Terminal and run the following options to perform basic updating tasks:
- List the updates, which will be listed as a name followed by a small information string that includes the version, size, and whether it is a recommended update and if it requires a restart:
sudo softwareupdate --list
- Specify an update to install. In this case, change the word NAME to be that of one of the packages in the list, or you can use "--all" to install every available update, or "--req" to install only important system updates.
sudo softwareupdate --install NAME
In addition to these steps to check for and apply updates, you can run the following options to perform other Software Update-related tasks such as ignoring updates or turning on automatic checking for new updates. In these uses of the command, replace NAME with the name of the update being targeted, as was outlined in step 2 above. For the scheduling option, you can replace "on" with "off" to turn off scheduled update checks.
sudo softwareupdate --ignore NAME
sudo softwareupdate --reset-ignored
sudo softwareupdate --schedule on
sudo softwareupdate --download NAME
These command-line based options mimic those in Apple's App Store, with the exception that so far there is no way to ignore an available update in the store. As a result, even though they are redundant with the more user-friendly options, if you have some Terminal familiarity, then you can use them to set the system to ignore certain updates or avoid using the App Store altogether, at least for system-related updates.