How to keep mac awake while updating

big sursleep-wakesoftware-updatesystem-prefs

I am upgrading from mojave to big sur and need to know how to keep my mac awake during this time. the terminal command caffeinate did not work, after some time the screen display went blank as usual. Is there a way to prevent the mac from going to sleep? Also, If i went to System Preferences > Energy Saver > Battery and put "Turn Display Off After:" to never, will the update be able to override that when it needs to restart the computer after the update file has installed?
Thank you in advance

Best Answer

The easy way at the command line is to call software update.

softwareupdate -a -i -r

The command prevents sleep, checks for all updates and then installs them. If the install requires a reboot, that happens immediately as well once the install is done.