How to Schedule Software Update Downloads
After Jeff Carlson’s article “Gutenprint Updates Printer Drivers without a Lot of Bandwidth” (2 January 2010), readers suggested a few alternatives to the core problem he ran into: the HughesNet bandwidth cap during all but late-night hours. The solution is obviously to schedule Software Update to download updates only during the few unlimited hours that HughesNet allows during the middle of the night – something that appears impossible using Apple’s Software Update preference pane. Here’s an overview of possible solutions in case you find yourself in a similar situation.
Macworld’s Suggestion — In an article in Macworld, Chris Breen pointed out that when you click the Check Now button in System Preferences > Software Update, the system automatically schedules future checks to start at that time. So if you click the button at 11:10 PM, future automatic checks will also occur at 11:10 PM – assuming the Mac is on and not sleeping.
To avoid staying up late to retrain Software Update, just reset the time appropriately in the Date & Time preference pane, and then click the Check Now button in the Software Update preference pane, as I’ve done in the screenshot. When you’re done, reselect the “Set date and time automatically” checkbox in Date & Time. Remember that if you ever click Software Update’s Check Now button manually at some other time of day in the future, you’ll have to repeat these steps to retrain Software Update for its late-night checks.
Note that on all current Mac models, the Energy Saver pane in System Preferences includes a Schedule button, which you can click to bring up an interface for configuring the Mac to turn itself on or wake up automatically.
The Command Line Answer — As a Unix user, I’d use Apple’s “softwareupdate” command in Terminal to download Apple’s updates, and the standard Unix cron tool to schedule when it runs. Every minute the cron program checks a list of scheduled “cron jobs,” and executes any that match the current time. Wikipedia has full details about cron, and Apple has several useful manual pages that will help if you want to go this route.
The command
softwareupdate --download --all
will download all outstanding updates, but not install them. This is suitable for running nightly at 11:10 PM on a HughesNet connection, as the download should be completed by 4 AM (when HughesNet reactivates bandwidth caps). If the download fails, the Mac will simply try again next time.
If you’re comfortable with Unix, you can simply use “crontab -e” (or “EDITOR=nano crontab -e” if you dislike the default vi editor). Then add an entry like this to download any outstanding updates at 11:10 PM daily (and skip sending a status email each time):
10 23 * * * /usr/sbin/softwareupdate --download --all >> /dev/null
Each update appears in your default Downloads folder as a folder containing a package and a “.dist” alias. Simply open the folder and double-click the .dist file to run the updater.
The Manual Option — Of course, you can also download updates manually from Apple. A TidBITS reader wrote in to suggest downloading required updates from the Apple Support Downloads page, either with a Web browser or a scheduling downloader such as Speed Download.
This approach is particularly useful if you’re caring for multiple Macs, since one installer can be used on all of them – as compared to Software Update, which downloads each updater independently on each Mac.
Manually downloading updates also makes sense if you have a fast connection (perhaps at work, at a friend’s house, at a coffee house, or at a public library; see “Find Free and Inexpensive Wi-Fi,” 23 December 2009) and can easily burn CDs or DVDs for Macs with slow or limited connectivity.
In The End — Whether you choose to reschedule Software Update from System Preferences, work through the command line, or install updates manually, download caps imposed by certain service providers needn’t prevent you from keeping your Mac healthy and up-to-date.
I am also a HughesNet customer. The one thing I wish Apple would address here are updates to the iPhone/iPod OS. As far as I know, you can schedule this, but only if iTunes is running and the device is connected. Then you are stuck staying up clicking your way through all the agreement screens. Fortunately these updates are infrequent.
Of course, I am dreaming of the day someone rolls out real broadband to semi-rural areas.
Hughes.net customer here too (25 miles west of Tulsa, Ok.). Believe it or not, my dream is voicemail for our landline and 3G for cell.... Sad, I know. I guess AT&T doesn't think we need it.
launchd should really be used in place of cron, it's been the canonical method since 10.4
'man launchd' and http://en.wikipedia.org/wiki/Launchd are good starting points.
You can also schedule the update at a certain time that is not the current one. It's a trick:
You turn off automatic time syncing, set the time manually to whenever you want the update to run, then do a manual Software Update.
Now the system has remembered that as the time for future updates, so you can just turn auto date-time syncing back on.
This was not my trick, I read it somewhere. But it works if you don't want to stay up to 3:00 am!
You may be able to get the same effect by editing /Library/Preferences/com.apple.SoftwareUpdate.plist I haven't tried it but the time of last update is stored in there.
I've been trying this method on my MacBook running Snow Leopard, and it hasn't worked - the laptop wakes up at the time I set, but Software Update doesn't run, even after I manipulate the time.
So I looked inside the preference file, and all I see listed is
*****
bplist00"_WebKitDefaultFontSize_WebKitStandardFont]Lucida Grande
%:<J
**********
So how would I add a time for Software Update to run?
Scripting and command lines are beyond my level of competence...please be specific!
Yup, I've done this now to avoid the confusing time in the screenshot.
Great article. My guess is that this will only work if you are logged in as an Admin? If you do a software update in a non admin account doesn't it require a password?
You should try. Most likely System Preferences will prompt you for an admin username & password to install.
So will double-clicking on an updater package or .dist file.
softwareupdate requires admin access, at least in Snow Leopard (my memory fades about Leopard quickly) to save the updates to disk. They wind up in /Library/Updates
crontab job needs to run as admin user.
launchd job needs to run as admin user.
crontab -e vs. bbedit
Anyone who tries this without more homework will be unhappy. BBedit needs help in the crontab case - explicitly stated in ''man bbedit'' -
"
Some tools (notably crontab), will not work correctly if your
EDITOR variable consists of multiple terms. You can work around
this by creating a simple shell script that calls bbedit -w, then
using the shell script as your EDITOR. For example:
#!/bin/sh
bbedit -w "$@"
"
Chris,
#1) As a regular user, "softwareupdate --download" downloads to your Downloads folder.
#2) Thanks for the reminder. You're right -- 'EDITOR=bbedit' isn't suitable, because the bbedit command returns immediately, before the user has a chance to edit & save the file.
I've now edited the article to remove the BBEdit suggestion, given that it wouldn't work.
hmm. I enter 'softwareupdate --list'' as a regular user.
I get the dialog box asking for administrator name and password.
Anything that needs to do the "Scan" requires admin privilege on my system.
Chris,
Both "softwareupdate --list" and "softwareupdate --download --all" work without password on my Snow Leopard system, and download also worked (passwordless) on my wife's Leopard system.
Are you running in a non-admin account, perhaps?
Otherwise, we should take this offline, and post a conclusion here if we can generate one.
yes, I'm running a non-admin account. My original comment pointed out that these commands need to be run as an admin account, and would do so perfectly well.
Doesn't everyone run as a non-admin user normally? ;-)
The following is an AppleScript that I use for automating the Software Update process. I am a monk, living alone, completely off-grid, in a remote corner of the Four Corners area. (The details are available at www.LotusDome.com .)
It works reliably here, "your mileage may vary."
Blessings!
Richard Fairbanks
----
(*
This is for updating Apple software during the HughesNet "free" time: 12:01-4:59AM Mountain Time
Using iCal to call the script:
- open iCal and create a "Software Update" event (I use a calendar I named "AppleScript")
- select the "Run Script" alarm and choose this script
- set the event to the proper times (as above)
- open System Events/Energy Saver/Schedule and make sure it is turned on and set to the proper times (as above)
- before you go to bed, turn the sound volume to mute and put the Mac to sleep
near the end of this script, replace ***your user name*** with your user name
in the next line, replace ***your password*** with your password
It should be all set! Go to bed and the rest should run on its own!
You can also give it a test run and then abort it when you can see that it works as intended.
be sure to leave yourself a note to turn off the energy saver settings or your Mac will keep starting up in the middle of the night!
*)
run application "Software Update" -- located at "Cupid:System:Library:CoreServices:Software Update.app:"
activate application "Software Update"
tell application "System Events"
tell process "Software Update" to tell window 1
delay 2
(* -- this was all for 10.4.11
repeat until exists sheet 1
delay 1
end repeat
*)
-- repeat while exists progress indicator 1 of window 1 -- this was for 10.4.11
repeat while exists progress indicator 1
delay 1
end repeat
delay 1
-- the following is in case there are no new updates and may be for different versions of the OS
if exists button "Quit" then -- of sheet 1 then -- this may be for OS X 10.5
click button "Quit" -- of sheet 1 -- the sheet was for 10.4.11
return
else if exists button "Install" then -- this is for OS X 10.6
click button "Install"
else if exists button "OK" of sheet 1 then -- this is for OS X 10.4.11
click button "OK" of sheet 1
end if
end tell
delay 1
-- the following repeat is needed to accept (the rare case of) multiple license agreements:
repeat with i from 1 to 10 -- assuming 10 is more than enough!
tell process "Software Update"
if window "License Agreement" exists then click button "Agree" of window "License Agreement"
end tell
delay 0.5
end repeat
-- the following is for authorization
repeat until (exists window 1 of process "SecurityAgent")
delay 0.5
end repeat
tell window 1 of process "SecurityAgent"
-- tell group 1 -- this is for OS X 10.4.11
tell scroll area 1 of group 1
-- most likely your user name will already be in text field 1, if not just remove the double hyphens at the start of the next line
-- set value of text field 1 to "***your user name***"
set value of text field 2 to "***your password***"
end tell
click button "OK" of group 2
end tell
delay 0.5
end tell
I was posting questions on this topic a few months back (since was always running over my Hughes.net quota) and got a lot of help from tidbits community. The option I went with was apple script combined with a program called Script Timer. It's been a simple and elegant solution for apple software updates as well as i-tunes podcast updates. Program also comes with several sample scripts.
Here is a new question I have been trying to answer - often I have a need to copy large files from a web site or remote host to say my MobileMe account. I am looking for a tool that will enable me to do this, as well as schedule the transfers between these two hosts *without* using my local machine (and my Hughes.net connection) as a temp storage area.
Would Interarchy, SpeedDownload, Fetch work for me? Any suggestions from the Tidbits community on this?