This is for doing a in-version update of macOS. The ARM and Intel versions are
a little different. Since Monterey (12.x), the commands below have worked pretty well.
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.
Do softwareupdate --list to get the label for the macOS update.
ARM
===================
softwareupdate --install "label for macOS update" --restart --user tokenuser
Software Update Tool
Finding available software
Downloading macOS version requested
Password: <<< ------ the password for the tokenuser
Downloading: 53.90%
Downloading: 100.00%
Downloaded: macOS version requested
Restarting...
Intel
===================
softwareupdate --install "label for macOS update" --restart
Software Update Tool
Finding available software
Downloading macOS version requested
Downloading: 16.19%
Downloading: 100.00%
Downloaded: macOS version requested
Restarting...