Shutdown and apply updates with OS X

11,557

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
Share:
11,557

Related videos on Youtube

instanceof me
Author by

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, 2022

Comments

  • instanceof me
    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
      Gordon Davisson over 13 years
      This 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
      HikeMike over 13 years
      If you're just concerned about power consumption, the login screen can go to sleep. Check your energy settings in System Preferences
  • lajuette
    lajuette over 13 years
    streetpc does NOT want to reboot.
  • dtlussier
    dtlussier over 13 years
    I'm not sure about the behaviour of sudo softwareupdate -i -a but if you want to shutdown instead of rebooting try sudo shutdown NOW.
  • Brian Postow
    Brian Postow over 13 years
    I 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
    Gordon Davisson over 13 years
    If 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 then softwareupdate -i -a; shutdown -h now
  • Blacklight Shining
    Blacklight Shining almost 11 years
    -1: sudo doesn't work like that! You want sudo -s "softwareupdate -i -a; shutdown -h now" (see Nick's answer)
  • Steven Linn
    Steven Linn over 8 years
    Why is it necessary to create a new shell?