Command Line Software Update Preferences

We just started using a Mac OS X 10.4.8 (PPC) Xserve to act as our in-house software update server. The preference for the location of the software update server is a user-level setting, I've specified this our server in Workgroup Manager.

Since Apple Remote Desktop does not have any kind of built-in "run software update" option, it seems we're going to have to send a Terminal command to the Macs I'd like to test running our software update on. I've found the "softwareupdate" command and if you specify an update to "--install", then it seems to work. However, it's not downloading from our internal software update server, it's going out to the Internet/Apple site. This is happening even if I use the Terminal directly from a logged-in user with the correct preferences. The interesting thing is that if you ask the command line software update to "--list" the updates, only the ones from our server are shown (the location of the server is noted in the text returned). However, when you actually tell it to "--install" then it goes out of our network and downloads from Apple. Running the Software Update System Preferences correctly finds the updates on our server and then downloads them from that server, so it seems to be a command line issue.

Is there a way to specify the location of the software update server in the command itself? The softwareupdate man pages were a bit sparse...

-Doug

2GHz Intel iMac 1GB RAM, 500GB HD Super Drive / 2GHz BlackBook 2GB RAM, 120GB HD, Mac OS X (10.4.8), 1.42GHz Mac mini 1GB RAM, 80GB HD / EyeTV Hybrid / 40GB iPod photo 2GB iPod nano

Posted on Jan 12, 2007 12:41 PM

Reply
17 replies

Jan 12, 2007 1:48 PM in response to Douglas McLaughlin

I thought you could run software update from ARD... I don't have it on my current machinet to be able to check.

You can, however, run Software Update via Server Admin. it's not as convenient since you can't batch or schedule it, but it can be done there. I have no idea whether that honors the preference setting or not.

My guess, though, is that the problem lies in the preferences. What user are you running softwareupdate as?
Have you checked the preferences to see what server is referenced? Off-hand you should be able to do it via something like:

<pre class=command> defaults read com.apple.softwareupdate</pre> and look for the CatalogURL value. You could also try setting that value (via defaults write) to see if that makes a difference.

Jan 12, 2007 2:07 PM in response to Camelot

Thanks! The only "Software Update" references I can find in the ARD3 manual specifically involve updating the ARD client software. There's no interface or GUI in ARD3 to tell a workstation to run software update.

We now have Software Update services running from one of our Xservs after enabling/configuring it with the Server Admin utility.

Whether I log in as the local administrator or an Open Directory-specified user, both users have our local Xserve as the software update server. If I run Software Update from the Apple menu or from the System Preferences, the location of our software update server appears at the top of the window. Installing the updates this way do come from our Xserve.

Running software update in the terminal on one of my test machines returns this:

$ softwareupdate --list
Software Update Tool
Copyright 2002-2005 Apple
2007-01-12 12:25:57.653 softwareupdate[27809] Loading CatalogURL http://OURXSERVEEDITEDOUT:8088/index.sucatalog
Software Update found the following new or updated software:
* iTunesX-7.0.2
iTunes (7.0.2), 26310K [recommended]


In my quick test, it's found our copy of iTunes. (I'm just testing for now with updates that don't require a restart, and iTunes is currently the only one enabled. My next experiment was going to be with the QuickTime 7.1.3 update that requires a restart.)

If I next give the command to install the "recommended" updates, the computer starts downloading the "J2SE 5.0 Release 4" from Apple:

$ sudo softwareupdate --install -r
Software Update Tool
Copyright 2002-2005 Apple
Downloading J2SE 5.0 Release 4


If I tell the same workstation to download the iTunes 7.0.2 update, specifically, it goes out to the Internet and downloads Apple's copy, not ours.

The command line softwareupdate is looking for our server, but receiving/downloading the updates it finds from Apple.

-Doug

Jan 13, 2007 10:18 AM in response to Douglas McLaughlin

Doug
Running the Software Update System Preferences correctly finds the updates on our server and then downloads them from that server, so it seems to be a command line issue.
Can't you just set up the client workstations to check for Software Updates "Daily" (or your preferred frequency) and just leave it at that? Presumably that would work identically to running it manually. Apart from a bit of extra disk activity, the client user won't notice unless there actually is something to update.
The softwareupdate man pages were a bit sparse...
How unusual! But I have to agree with you there 😟

Jan 13, 2007 10:52 AM in response to Michael Conniff

No, the individual users are not admins so they can't run it themselves. I don't want them to run it. We need to be able to run it for them.

Also, for future planning, corporate IT expects the Macs to work just like the Windows PCs. They can push out an update via SMS and have it install on every PC in the OU. We need to be able to prove we can keep the Macs up-to-date with security updates and things so they allow the Macs to use the corporate network. So, I need to be able to push out the updates when we choose.

Camelot and I figured out a work around just as I was leaving work last night via iChat. I will post the results this morning, I just didn't have time last night.

-Doug

Jan 13, 2007 10:40 AM in response to Michael Conniff

From your output, it seems to have a "CatalogURL" used for the 'list' option, but this doesn't appear in either of the preference files.


This line in the preferences won't appear unless you've manually edited the preference file to point to your own specific Software Update server. If it's blank, it looks for the standard Apple server.

-Doug

Jan 13, 2007 10:40 AM in response to Douglas McLaughlin

🙂
Was about to edit my previous post by adding this:


But let's see if your server has altered the preferences: on the client machine that you used for that output:

defaults read com.apple.softwareupdate | grep URL
defaults read /Library/Preferences/com.apple.softwareupdate | grep URL

(The first of these just looks at the plist in your Home>Library>Preferences).

Jan 13, 2007 10:50 AM in response to Michael Conniff

The users at work do have the software update server edited already (I'm home now, so I can't test it for you). This edit was part of our software image that we use to install all the Macs. The edited software update preference file is part of the user template that we edited to include all our software in the Dock and our custom Desktop picture, among other customizations.

The issue was, if you run software update from the Apple menu or the System Preferences, it finds updates and downloads from our Xserve. That's just fine. However, I need to send a command via the command line through Apple Remote Desktop 3 to tell a list of Macs to run software update. When the do this and "list the available" updates, they find the updates from our server. However, when they're told to "install" the available updates, for whatever unknown reason due to some kind of software bug with the command line tool, they install the updates from Apple. So, I know our preferences are set correctly from Mac OS X and the GUI. But the command line tool does not follow those edits/customizations correctly.

-Doug

Jan 13, 2007 4:28 PM in response to Douglas McLaughlin

Sorry for the confusion in this topic, I was unable to post the work-around we figured out after leaving work yesterday. Here is a summary:

1. Users on the computer have the correct, edited preference file that includes the location of our Xserve that's running Mac OS X Server's Software Update services.

~/Library/Preferences/com.apple.softwareupdate.plist

If a user runs Software Update from the Apple Menu or the System Preferences after logging in, the Software Update correctly finds our published updates, downloads them, installs them and that would be fine. However, none of our users are administrators, so they don't have the privileges to install updates. Therefore, we need to run it for them, behind the scenes.

2. If I use Apple Remote Desktop (administrator) 3.1 to send a "softwareupdate" Unix command to a workstation (where no one is logged in) to "--List" the available updates, the correct updates published by our Xserve are discovered and listed.

3. If I use Apple Remote Desktop (administrator) 3.1 to send a "softwareupdate" Unix command to a workstation (where no one is logged in) to "--Install --all" the available updates, then the software update commend bypasses the user's preferences (or some kind of cached location) and finds Apple's published updates, starts downloading and installing them. This seems to me to be a bug.

Work around (not really a "solution" since it seems the softwareupdate command is not behaving correctly):

Edit the main Software Update preference file to include the local Software Update Server:

/Library/Preferences/com.apple.softwareupdate.plist

After doing that, sending the Unix "softwareupdate" command not only lists the available updates from the local server but they download from that location as well. I plan to send Apple some Apple Remote Desktop feedback noting the bug and a second one for a feature request to add an option to automatically send a softwareupdate command from the ARD GUI.

-Doug

Jan 14, 2007 7:46 AM in response to Douglas McLaughlin

Hi Doug,
I'm sorry but I don't see the bug. You set a preference for some user (about whom you give no information) and when you run softwareupdate as that user it respects the preference. Then when you run softwareupdate as root it doesn't respect the preference. Is there a reason to expect it to? Did you set the preference for the root user? Try what Michael suggests and add the following command to the list:

sudo defaults read com.apple.softwareupdate | grep URL
--
Gary
~~~~
QOTD:
"If you keep an open mind people will throw a lot
of garbage in it."

Jan 14, 2007 10:03 AM in response to Gary Kerbaugh

Then when you run softwareupdate as root it doesn't respect the preference.


This seems to be a bug in the "softwreupdate" Unix command, not ARD. When it's asked to "list" updates, it finds the local sever and returns one result. When it's asked to "install", it finds a different server and downloads/installs different results.

After updating the main /Library/Preferences/com.apple.softwareupdate.plist with the custom server, the root command does go through correctly. It's unclear, at least to me, why the "softwareupdate" command would find two different results from those two commands before making that specification.

-Doug

Jan 14, 2007 11:18 AM in response to Douglas McLaughlin

Hi Doug,

> After updating the main
/Library/Preferences/com.apple.softwareupdate.plist with the
custom server, the root command does go through correctly.


I would expect that on machines where there is no /var/root/Library/Preferences/com.apple.softwareupdate.plist preferences file. Maybe that's not true of all of your machines.
--
Gary
~~~~
I remember when legal used to mean lawful,
now it means some kind of loophole.
-- Leo Kessler

Jan 14, 2007 2:19 PM in response to Douglas McLaughlin

It's unclear, at least to me, why the "softwareupdate" command would find two different results from those two commands before making that specification.


the global pref in /Library/Preferences/com.apple.softwareupdate.plist applies to all users. the ~/Library/Preferences/com.apple.softwareupdate.plist apply to just those users who have the modified copy, as you'd expect.

when you use ARD to send a command, you have to do it as a user. if the currently logged in user isn't an admin but has the pref file, it will look at your software update server. that seems to make perfect sense, no?

when you sent the softwareupdate command before, did you send as root, another admin account, or a non-privileged user? that makes a big difference.

can you ssh to a test machine and try the same thing? with /Library/Preferences/com.apple.softwareupdate.plist set, you shouldn't have any problems.

alternatively, you could set up scheduled tasks to push out the updates via ARD 3.x, though you shouldn't need to do that with a working com.apple.softwareupdate.plist configured on all client machines.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Command Line Software Update Preferences

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.