Mac OS X Server: How to remotely install software using the softwareupdate command-line tool
Summary
You can use the softwareupdate Terminal command to find new versions of software and install them on a remote server.
Products Affected
Mac OS X Server
- Open Terminal (/Applications/Utilities/).
- Log in to the target server via SSH. Type this at the prompt:
ssh <admin_name>@<server_address>
Note: Replace "<admin_name>" with the short name of your Admin user account on the remote computer, and replace "<server_address>" with either the DNS name or IP address of the target server, so that it would look like "ssh melanie@myserver.example.com" or "ssh melanie@10.0.2.33". You can omit the "@" portion of the command, but doing so results in an attempt to log in via ssh using the user name with which you are logged into the computer at which you are typing. This only works if your account name is the same on both computers.
- Press Return.
- When prompted, enter the password for the Admin user.
- Type sudo -s and press Return.
- When prompted, enter the password for the Admin user again.
- Type: softwareupdate --list
- Press Return. You will see a list of available updates. For example:
Software Update found the following new or updated software:
* QuickTime-7.4.5
QuickTime (7.4.5), 60980K [recommended] [restart]
* iTunesX-7.6.2
iTunes (7.6.2), 46070K [recommended]Important: if the update is marked "[restart]" you will need to reboot the server immediately after installation. Make sure that no users are connected to the server before you install the update.
- To install the desired software, type softwareupdate -i followed by the names of the desired items. If you wanted to install the QuickTime 7.4.5 and iTunes 7.6.2 updates in the example above, you would type: softwareupdate -i QuickTime-7.4.5 iTunesX-7.6.2
Note: You can, alternatively, type softwareupdate -i -a (and press Return) to install all available updates.
- The Software Update tool will report progress as it downloads and installs the updates. If you are not instructed to restart, you may type exit and then press Return. This terminates the sudo command. Type exit and press Return once more to terminate the ssh session.
If a restart is required after the update, type reboot (and press Return) to restart the server. This ends your ssh session.
Additional Information
In Mac OS X Server version 10.5.4 or earlier, it is suggested you start this process by using the sudo -s command, because after installing certain system updates you may not be able to authenticate again before restarting the server.
The softwareupdate command-line tool is available on Mac OS X client version of the operating system and may be used if Remote Login is enabled in the Sharing preferences, in System Preferences.