How To Update Apple OS X Using Command Line Software Update Tool

in Categories , , , last updated October 26, 2015

How do I install software updates from the command line tool on my Apple Mac OS X computer? How can I remotely update my Apple computer by just sshing into a system? Is there is something like apt-get command or yum command for Apple OS X?

You need to use the softwareupdate command to checks for new and updated versions of your software based on information about your Apple Mac computer and current software. This command requires admin authentication for all commands i.e. you need to run it using sudo tool. In this tutorial you will learn how to install software updates from the bash command line on a Mac OS X.

How do I find all available updates?

Open the terminal app and type the following commands. Type the following command:
softwareupdate -l
OR
softwareupdate --list
Sample outputs:

Fig.01:  List all available updates
Fig.01: List all available updates

From the above update we get a list as follows:

* RAWCameraUpdate6.17-6.17
	Digital Camera RAW Compatibility Update (6.17), 7455K [recommended]

Where,

  1. RAWCameraUpdate6.17-6.17 is software available to update also know as the identifier.
  2. 6.17 is version number
  3. 7455k download size
  4. Please note that updates that need a restart are marked with [restart].

How do I install specified update?

To install update called ‘RAWCameraUpdate6.17-6.17’, enter:
sudo softwareupdate -i RAWCameraUpdate6.17-6.17
Sample outputs:

Password:
Software Update Tool
Copyright 2002-2015 Apple Inc.
 
 
Downloading Digital Camera RAW Compatibility Update
Downloaded Digital Camera RAW Compatibility Update
Installing Digital Camera RAW Compatibility Update
Done with Digital Camera RAW Compatibility Update
Done.

A note about dealing with update names with white spaces

Some update names may include spaces, enclose the update name using a single quote character as follows:
sudo softwareupdate -i 'OS X El Capitan Update-10.11.1'

How do I see software download and update progress?

Pass the -v option as follows:
sudo softwareupdate -vi RAWCameraUpdate6.17-6.17
OR
sudo softwareupdate -v -i iTunesXPatch-12.3.1
Sample outputs:

Software Update Tool
Copyright 2002-2015 Apple Inc.
 
 
Downloading iTunes
   Progress: 1%
   Progress: 2%
   Progress: 3%
   Progress: 4%
   Progress: 5%
   Progress: 6%
   Progress: 7%
   Progress: 8%
   Progress: 9%
   Progress: 10%
   ....
   ..
   ...
   Progress: 48%
   Progress: 49%
Downloaded iTunes
Installing iTunes
   Progress: 51%
   Progress: 53%
   Progress: 54%
   Progress: 56%
   Progress: 57%
....
..
..
   Progress: 97%
   Progress: 99%
Done with iTunes
Done.

How do I just download update but not install on my system?

Use the following syntax:
sudo softwareupdate -d nameHere
sudo softwareupdate -d iTunesXPatch-12.3.1

To cancel a download, enter:
sudo softwareupdate -e

How do I apply all recommended updates?

All updates that are recommended for your system:
sudo softwareupdate -r
To install all updates that are applicable to your system, enter:
sudo softwareupdate -i -a
Install all but make sure you ignore ‘JavaForOSX’ updates:
sudo softwareupdate --ignore JavaForOSX
To clear the list ignored updates, enter:
sudo softwareupdate --reset-ignored

Turn on or off automatic background check

Automatic check is on
sudo softwareupdate --schedule on
Automatic check is off
sudo softwareupdate --schedule off
To see info on all options, type:
man softwareupdate
softwareupdate -h

Sample outputs:

usage: softwareupdate <mode> [<args> ...]
 
** Catalog Management:
	--set-catalog <URL>	Set the new catalog URL (requires privileges)
	--clear-catalog		Clear the catalog URL back to defaults (requires privileges)
 
** Manage Updates:
	-l | --list		List all appropriate update labels (options:  --no-scan)
	-d | --download		Download Only
	-e | --cancel-download		Cancel a download
	-i | --install		Install
		<label> ...	specific updates
		-a | --all		All appropriate updates
		-r | --recommended	Only recommended updates
	--background		Trigger a background scan and update operation
	--ignore <label> ...	Ignore specific updates
	--reset-ignored		Clear all ignored updates
 
** Other Tools:
	--suspend-background (on | off)	Suspend background operations from occurring temporarily (uses --duration)
		--duration <duration>)		Optional duration in seconds to suspend background operations (defaults to 5*60 seconds)
	--dump-state		Log the internal state of the SU daemon to /var/log/install.log
** Options:
	--no-scan		Do not scan when listing or installing updates (use available updates previously scanned)
 
-v | --verbose	Enable verbose output
-h | --help	Print this help

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Share this on (or read 6 comments/add one below):

6 comment

  1. I’m curious is ‘sudo softwareupdate -r’ avoids a major release such as El Capitan and sticks to the current OS. For instance if the user is on Yosemite 10.10.3, would it only pull them up to 10.10.5 latest?

  2. When I type in “softwareupdate -1” it says, Software Update Tool Copyright 2002-2010 Apple. I can’t download El Captain because it says “No such update”. Is it because the copyright is too old? If so, how can I change it?

  3. By updating os using teminal will it do any harm to my data?
    or else can i update the os using this terminal thing

    Have a question? Post it on our forum!