This is what I use
sudo softwareupdate --install --all --restart --list --include-config-data
Each update specified by args is downloaded and installed.
All updates that are applicable to your system, including those non-recommended ones, which are prefixed with a - character in the --list output. (Non-recommended updates are uncommon in any case.)
Automatically restart (or shut down) if required to complete installation. If the user invoking this tool is logged in then macOS will attempt to quit all applications, logout, and restart. If the user is not logged in, macOS will trigger a forced reboot if necessary.
--include-config-data is something that I learned about from:
where he said
In Sierra and High Sierra you can add system and security updates
I actually have a
launchd which runs this command every night on all of my Macs at like 4am so that I never have to deal with waiting for the updates to complete.
This is not for Mac App Store apps, of course. For that you can try
mas but I’ve found it to be very hit-or-miss, which is not too surprising since it is working with undocumented APIs and not intended to be used this way.
The most reliable way that I’ve found to check for updates in the Mac App Store is to use this:
which should launch the Mac App Store and tell it to check for app updates.
However, I still run MacUpdater (not to be confused with “MacUpdate Desktop”) every few days to check for app updates, and it finds Mac App Store apps which have updates. In that case I just open the individual page for the Mac App Store app and click the “Update” button.
(ps - MacUpdater is a great app for updating your Mac apps, and it’s only $10 [one-time fee], vs MacUpdate Desktop which is a terrible app and costs $20-40/year.)