softwareupdate
NAME
softwareupdate – system software update tool
SYNOPSIS
softwareupdate command [args …]
DESCRIPTION
Software Update checks for new and updated versions of your software based on information about your computer and current software.
Invoke softwareupdate by specifying a command followed by zero or more args.
softwareupdate requires admin authentication for all commands except –list. If you run softwareupdate as a normal admin user, you will be prompted for a password where required. Alternatively, you can run softwareupdate as root and avoid all further authentication prompts.
The following commands are available:
-l | –list
List all available updates.
-i | –install
Each update specified by args is downloaded and installed. args can be one of the following:
-r | –recommended
All updates that are recommended for your system. These are prefixed with a * character in the –list output.
–os-only Only macOS updates
–safari-only
Only safari updates
-R | –restart
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. If you wish to always perform a forced reboot, pass -f (–force).
-a | –all 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.)
item … One or more specified updates. The –list output shows the item names you can specify
here, prefixed by the * or – characters. See EXAMPLES.
–stdinpass
Password to authenticate as an owner. Apple Silicon only.
–user Local username to authenticate as an owner. Apple Silicon only.
–list-full-installers
List the available macOS Installers.
–fetch-full-installer
Install the latest recommended macOS Installer. Use –full-installer-version to specify the version
of macOS to install. ie. –full-installer-version 10.15
–install-rosetta
Install Rosetta. Only applies to Apple silicon Macs. Pass –agree-to-license to agree to the software
license agreement without any user interaction.
-d | –download
Each update specified by args is downloaded but not installed. The values of args are the same as for
the –install command. Updates downloaded with –download can be subsequently installed with
–install, or through the App Store (as long as they remain applicable to your system). Updates are
downloaded to /Library/Updates, but are not designed to be installed by double-clicking the packages
in that directory: always use –install or the App Store to actually perform the install.
–schedule Returns the per-machine automatic (background) check preference.
-h | –help
Print command usage.
EXAMPLES
The following examples are shown as given to the shell:
softwareupdate –list
Software Update Tool
Finding available software
Software Update found the following new or updated software:
* Label: MacBookAirEFIUpdate2.4-2.4
Title: MacBook Air EFI Firmware Update, Version: 2.4, Size: 3817K, Recommended: YES, Action: restart,
* Label: ProAppsQTCodecs-1.0
Title: ProApps QuickTime codecs, Version: 1.0, Size: 968K, Recommended: YES,
* Label: JavaForOSX-1.0
Title: Java for OS X 2012-005, Version: 1.0, Size: 65288K, Recommended: YES,
sudo softwareupdate --install JavaForOSX-1.0
Software Update Tool
Finding available software
Downloading Java for OS X 2012-005
Downloaded Java for OS X 2012-005
Installing Java for OS X 2012-005
Done with Java for OS X 2012-005
Done.
sudo softwareupdate --schedule.
Automatic check is on
sudo softwareupdate --clear-catalog
sudo defaults delete /Library/Preferences/com.apple.SoftwareUpdate CatalogURL
softwareupdate --fetch-full-installer --full-installer-version 10.15.7 --verbose
Saved in /Library/Updates.
See post attempt and or successes by running this:
softwareupdate --dump-state
dumps in /var/log/install.log
You can observe the progress softwareupdate is making by viewing its logging messages.
Just run sudo log stream –predicate “processImagePath Contains[c] ‘softwareupdate'” in another terminal to view the log messages live. Or look at logged messages during the last 10 minutes by using sudo log show –last 10m –predicate…
Link:
https://apple.stackexchange.com/questions/354879/how-do-i-observe-and-control-a-macos-update-using-softwareupdate
https://www.hexnode.com/mobile-device-management/help/script-to-update-os-in-macos-devices/
https://derflounder.wordpress.com/2021/03/03/listing-the-full-os-installers-available-from-apples-software-update-feed-on-macos-big-sur/