How to remotely install software updates using the command line

You can use the 'softwareupdate' command to find new versions of software and install them on a remote server.

This article has been archived and is no longer updated by Apple.

First, connect to the remote server using SSH, or by using Terminal from a Screen Sharing session.

Some options require the softwareupdate command to be run as root, so you might start by using the sudo command to enter a root shell:

sudo -s

You then need to enter an administrator's password when prompted.

You can use the -l or --list argument to see which updates are available.

softwareupdate --list

This returns a list like the following.

Software Update found the following new or updated software:
   * OSXUpd10.10.2-10.10.2
OS X Update (10.10.2), 425742K [recommended] [restart]
   * RemoteDesktopClient-3.8.2 v1.1
Remote Desktop Client Update (3.8.2 v1.1), 7123K [recommended]
   * iTunesX-12.1
iTunes (12.1), 206776K [recommended]

Updates that require a restart are marked with [restart].

You can use the -i or --install argument to install one or more of the available updates. For update names that include spaces, enclose the name using a single quote character ('). For example, to install the Remote Desktop and iTunes updates listed above, use this command:

softwareupdate --install 'RemoteDesktopClient-3.8.2 v1.1' iTunesX-12.1

Or you can use the -a or --all argument to install all available updates:

softwareupdate --install --all

The Software Update tool will report progress as it downloads and installs the updates. When it is finished you can either use the exit command to exit your root shell, or the reboot command to restart the server (if required by the update.)

To see more options and usage instructions, type:

man softwareupdate

Learn More

The softwareupdate command is also available in OS X client version of the operating system and can be used remotely if Screen Sharing, Remote Login, or Remote Management is enabled in the Sharing pane of System Preferences.

Published Date: