Getting Software Update alerts as a standard user

Jan 30, '12 07:30:00AM

Contributed by: idoadam

I have Mac OS X check for updates daily and automatically download any updates. However, only when I log in as an administrator do I get a dialog box informing of the existence of updates.

I wrote a short AppleScript to take care of the issue. Note that the script does not check for updates itself but relies on OS X's checking it in the background so it requires that the options to check for updates periodically and download updates automatically be checked in the Software Update preference pane.

Create the following script in the AppleScript Editor and save it as an application:

-- A script alerting non-administrator users about available downloaded
-- software updates

set updates_no to do shell script "defaults read /Library/Preferences/ LastUpdatesAvailable"
if (updates_no > 0) then
    set dialogResult to display dialog updates_no & " software update(s) are avalaible. Launch Software Update?"
    if button returned of dialogResult = "OK" then
      ignoring application responses
        tell application "Software Update" to activate
      end ignoring
    end if
  on error number -128
    -- The user canceled so do nothing
  end try
end if
Please, do not include any new line in the do shell command, otherwise, the script will fail. Add the script application to your standard account's Login Items.

From now on, whenever you login into that account *after* the automatic check downloaded new updates, a dialog bode informing you of the updates and suggesting to run Software Update for you is displayed. Of course, an administrator password is still required by Software Update.

This Script has been tested on Mac OS X 10.7.2 and detected the downloaded iTunes 10.5.3 update.

[crarko adds: I didn't have any updates available to try this with.]

Comments (7)

Mac OS X Hints