Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I don't have a server or anything, but I have 1 iMac running Snow Leopard in my office that a nontechie uses. I would like for it to automatically install any new updates when the computer is told to shut down every day. I know I can set Software Update to check for updates daily, and download them if they exist. But what about actually installing them without confirming each time. I don't want to do a cron job, because if that person is working late it wouldn't be good if it tries to shut down on them. Also that person is running with a std user account, so to install updates I have to enter my admin level account's credentials. Is there any way to do this?

share|improve this question
    
Anything automatic would require storing your password on the computer which is a bad idea. Can you adjust his account so he can install the updates himself. If he has a computer he should be able to manage them. –  Ramhound Jun 3 '11 at 12:21
    
I don't know what I can do to authorize his account to be able to install updates, but not change other system settings. Any ideas on doing that? –  jamone Jun 3 '11 at 12:42

1 Answer 1

up vote 3 down vote accepted

Installing updates (or doing anything else, for that matter) on shutdown on Mac OS X is problematic, as the operating system gives processes just eight seconds to shut down before it kills them - not nearly enough time to do updates.

Nonetheless, there are probably ways to solve your problem. Depending on how well you and your user's working patterns match up, you could wait for them to notify you that there are updates and it's convenient for them to restart, then type your administrator password in person or over VNC/Screen Sharing.

Alternatively, if you have SSH active, you can log in and use the command-line program softwareupdate instead.

Apple suggest that you should restart your computer immediately after running softwareupdate if there is an update that requires it, but you may be able to allow the computer to restart normally at the end of the day - the restart certainly isn't forced by the update program, as it is with the GUI version. If you're willing to risk this you can then script it: create the following Launchd property list.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>some.meaningful.name</string>
    <key>ProgramArguments</key>
    <array>
        <string>softwareupdate</string>
        <string>-i</string>
        <string>-a</string>
    </array>
    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer>20</integer>
        <key>Minute</key>
        <integer>00</integer>
    </dict>
    <key>RunAtLoad</key>
    <false/>
    <key>KeepAlive</key>
    <false/>
</dict>
</plist>

Save this in /Library/LaunchDaemons/some.meaningful.name.plist, then in a terminal do:

sudo launchctl load /Library/LaunchDaemons/some.meaningful.name.plist

This will run softwareupdate every day at 20:00, and install all available updates.

share|improve this answer
1  
Good to know that softwareupdate doesn't force the restart. Very convenient. Any idea if that can break things when continuing to use the machine? –  Daniel Beck Jun 3 '11 at 16:33
    
@Daniel Beck I really don't know. The Apple instructions (for OS X Server, though softwareupdate is on the client, too) I linked to say "Important: if the update is marked "[restart]" you will need to reboot the server immediately after installation." which implies it's best to restart immediately, but they don't give any more details. That said, if the risk of Something Bad Happening was that huge, I would have thought softwareupdate would restart the machine itself. –  Scott Jun 3 '11 at 18:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.