This is for doing a major upgrade of macOS. The ARM and Intel versions are
a little different.
Presently, one could do this via softwareupdate command. However we prefer doing this
via the "Install macOS <macos-version>.app". This allows you to chose the exact version
of macOS you wish to upgrade to.
From an admin user account, acquire a root shell via sudo su - root.
You must also have the password for a user account who has a secure token.
Typically this is the first user created or it may be given to you from someone
who has a secure token. Here I will refer to this user with a secure token as tokenuser.
#: Download a copy of the install macos app.
curl https://www.cns.nyu.edu/installmacos/mymacos.tgz | tar xz -C /Applications
where mymacos is the name of the macOS you wish to upgrade to e.g. tahoe, sequoia, sonoma, ventura, etc ..
ARM
===================
cd /Applications/Install macOS <macos version>.app/Contents/Resources
./startosinstall --agreetolicense --forcequitapps --user tokenuser --passprompt
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
Password: <<< ------ the password for the tokenuser
Preparing to run macOS Installer...
Preparing: 11.4%
Preparing: 100%
Restarting...
Intel
===================
cd /Applications/Install macOS <macos version>.app/Contents/Resources
./startosinstall --agreetolicense --forcequitapps --user tokenuser
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
Preparing to run macOS Installer...
Preparing: 7.1%
Preparing: 100%
Restarting...
NOTES:
============
1. You can download the full macOS installers for the version of macOS of interest via the Apple App Store
or you can use the softwareupdate binary to download it as follows.
softwareupdate --fetch-full-installer --full-installer-version <version-number>
where version-number could be 26.1, 15.7.2, 14.8.2, 13.7.8, etc ..
2. The method actually worked all the way back for upgrading from Yosemite forward. I have used it to
upgrade from Yosemite to Sierra.