One of the leading reasons to dive into the command-line tools in macOS is automation. Writing scripts that link with the Shortcuts stuff adapted from iOS means you can automate some things.
For instance, there is a command-line tool that you can use to run software updates: software update
.
Consider:
softwareupdate -l
This gets you a list of available software just like what happens in System Preferences when you launch the Software Update preference pane. In both cases, the utilities are talking the softwareupdate daemon in the operating system.
Next up, getting stuff installed:
softwareupdate -I NAME
softwareupdate --install name
You replace NAME with one of the items from the list you asked for in the first step. Be careful there as macOS is very sensitive about names and format of names. You should quote the names and watch out for cases where the name has trailing spaces.
The “-d” option will just download an update while including the “-a” option will install all available updates. One of the useful options for this command-line tool is “–install-rosetta”. This option tells macOS on Apple silicon Macs to install the Rosetta 2 hypervisor/emulator for Intel macOS applications. Include the –agree-to-license” option to agree to the software license agreement without user interaction.
Selah.