Shutdown and apply updates with OS X
Solution 1
I think that if you download all updates and then shutdown your mac instead of restarting (ignoring popup), it will install updates and shutdown.
Solution 2
This method seems to be more successful for me:
$ sudo sh -c "softwareupdate -i -a; shutdown -h now"
The above sudo -s
technique simply opened a new root shell for me (OS X Lion) which, upon exiting, ran the following two commands as a non-root user.
I guess an alternative would be to switch to root first, then run the two commands (separated by semi colon)
$ sudo su -
$ softwareupdate -i -a; shutdown -h now
Solution 3
If you use the GUI software update, you may need to stick around and select "Yes" for certain dialog boxes. If you really want to minimize your time and effort involved in applying updates and then shutting down the computer, try this:
sudo -s; softwareupdate -i -a; shutdown -h now
Related videos on Youtube
instanceof me
French I.S. Engineer, full-stack Web developer. Favorite fields: development, usability, optimization, security, semantics, Web. I also like photography and some real life things. twitter.com/instanceofme instanceof.me
Updated on September 17, 2022Comments
-
instanceof me over 1 year
Is it possible to shutdown + update the Mac ? It's annoying to wait for it to restart when I just want to click update and go home.
I've seen this once on a MacBook and I can't find how to do it.
-
Gordon Davisson over 13 yearsThis may not be a good idea; some updates require 2 reboots to finish -- it reboots into a minimal OS, installs files that weren't safe to replace on a fully-operational system, then reboots again. What you really want it to do is to reboot, finish the update, then shut down; I don't think there's a way to do that.
-
HikeMike over 13 yearsIf you're just concerned about power consumption, the login screen can go to sleep. Check your energy settings in
System Preferences
-
-
lajuette over 13 yearsstreetpc does NOT want to reboot.
-
dtlussier over 13 yearsI'm not sure about the behaviour of
sudo softwareupdate -i -a
but if you want to shutdown instead of rebooting trysudo shutdown NOW
. -
Brian Postow over 13 yearsI do this all the time... in particular, if you do the update, but when it asks to reboot, you say "not now" and kill the update process, when you shut down the computer it will ask if you want to install. Click yes, and walk away.
-
Gordon Davisson over 13 yearsIf the installation takes more than 5 minutes, your sudo validation will expire and the second sudo will hang waiting for you to retype your password. Better to use
sudo -s
and thensoftwareupdate -i -a; shutdown -h now
-
Blacklight Shining almost 11 years-1:
sudo
doesn't work like that! You wantsudo -s "softwareupdate -i -a; shutdown -h now"
(see Nick's answer) -
Steven Linn over 8 yearsWhy is it necessary to create a new shell?