How To Update macOS Using Command Line Software Update Tool

How do I install software updates from the command line tool on my Apple macOS / 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 macOS/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 macOS/OS X.
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Apple macOS or OS X with Terminal application
Est. reading time 3 minutes

Procedure to update macOS using command

  1. Open the terminal application on your macOS (Applications > Utilities > Terminal)
  2. Check for macOS update using the
    softwareupdate -l
  3. Note down available updates names.
  4. Install new updates on macOS using the following command:
    sudo softwareupdate -i update_pkg_name

Let us see how to update macOS using a terminal command in details.

How do I find all available updates on macOS?

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

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

Updating Mac using the Terminal app

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

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

Here is what I see:

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

Summing up

In this quick guide, we explained to you how to update your Mac using Terminal. You can use bash for loop to update multiple MacMin/MacPro or laptops as follows:

for i in macmini1 macmini2 192.168.2.100 192.168.2.101
do
   ssh -t user@${i} sudo softwareupdate -i -a
done

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 6 comments so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
6 comments… add one
  • Drew Nov 19, 2015 @ 19:02

    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?

    • 🐧 Vivek Gite Nov 19, 2015 @ 19:16

      Pass the --ignore option to ignore El Capitan.

  • DXC May 14, 2016 @ 20:07

    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?

    • Henrik May 18, 2016 @ 7:15

      Try using “-l” instead of “-1”. (the letter L instead of the number 1)

  • vijay Feb 8, 2017 @ 6:25

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

  • Luna Apr 26, 2017 @ 9:28

    This article helped me at work today :)

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum