4

I am looking for a silent (unattended) way of updating OS X that would not require use intervention.

Is this possible, how?

bmike
  • 235,889
sorin
  • 29,875

2 Answers2

4
$ sudo softwareupdate --list
$ softwareupdate -a -i -R

This tool - even if updates come from the App Store app, does not update any purchased apps. You need the GUI to update those apps at present time since Apple did not include a tool to automate those updates.

The first just scans for appropriate updates. The second installs all updates and only restarts if the updates call for a restart.

Play around to see what works best for you. It's trivial to automate these using launchd if that suits your needs as well.

I've had better luck rebooting the Macs before the update. If I'm going to cut users off with unsaved data, I'd rather do that first and let the update go cleanly. Updating a program that is currently running is something I like to avoid.

Here is a nice article explaining the details from Apple. It works fine on non-server version of Mac OS X as noted at the end of the article.

bmike
  • 235,889
  • I see a big issue with the update command: it will reboot the computer even if there are no updates. – sorin May 15 '11 at 08:28
  • I'll edit the answer since the shutdown won't really work as written (the sudo ends before the && forks as originally written). Since software update will let you know a reboot is needed you can only reboot then or just ignore it until you arrive. – bmike May 16 '11 at 19:53
  • @sorin how are things now. I’ve tested the shutdown -aiR many times and never had it restart but if you’re seeing that, you can not specify the R or —restart of you need to be sure you delay / control the restart. Apologies for missing your comment until now. – bmike Sep 19 '22 at 10:41
2

The softwareupdate command was updated with MacOS release 10.13.4 with a --restart option. Use

sudo softwareupdate --install --all --restart

And the computer will restart if needed

pgcudahy
  • 165