Install Software Updates from the Command Line

Apr 18, 2007 - 4 Comments

Terminal in OS X We all know the familiar Mac OS X Software Update and App Store Updates panel, it pops up weekly to give us a nice GUI interface to install all the latest updates to our Apple software. But did you know that you can get the same list, query the available updates list, and even install updates from the command line?

Installing software updates from the command line is incredibly useful for remote management of machines, just SSH into a Mac and run the appropriate commands. Read on for more…


To install software updates from the command line, you’ll use the aptly named ‘softwareupdate’ command. Here are the most relevant usages of the command for most users:

softwareupdate -l

will give you a list of all updates available

softwareupdate -i [package name]

will install the specified package

softwareupdate -i -a

will install all updates available

softwareupdate -i -r

will install only the recommended updates

softwareupdate --ignore [package name]

will ignore specified update

softwareupdate --help

for more info on the softwareupdate command

You’ll likely need to use the sudo command to actually install the updates on a Mac, simply place sudo in front of one of the above commands to run it with full permissions as root.

For example:

sudo softwareupdate -i -r

.

Related articles:

Posted by: William Pearson in Command Line, How to, Mac OS, Tips & Tricks

4 Comments

» Comments RSS Feed

  1. klaus says:

    great, I have broken my logon. windowserver crashed.

    maybe this is my hope :(

  2. lakorai says:

    For users trying to do this over Apple Remote Desktop and you would like to pull the updates from a local OSX Server you do this:

    Open up Apple Remote Desktop
    Choose the computers you wish to update from the computer list that you have created. Click the UNIX button at the top of the window.

    IMPORTANT: On the ratio button click the “user” button. Now type in the username that you use in ARD to control the machines. In my case I use “arduser”. If you don’t do this ARD will complain that a correct console user is not available.

    Next type in the command

    softwareupdate (switches as described above) (ip address or domain name of local OSX Update server)

    where the switches are the type of command you want (-l, -a etc)

    and the IP address of the server you want to pull from.

    in my example it would be

    softwareupdate -i 192.168.1.240

    This will tell Software Update to list all available updates AND to poll those updates from 192.168.1.240 NOT from Apple’s SU servers. If you WANT ard to pull from the Internet then just don’t place an ip address or domain after the command (this is what you want if you aren’t running a OSX Server on your network)

    You can use a domain name instead if your DNS settings are set in the Network control panel and your DNS server(s) are setup correctly.

  3. anon says:

    For the record, I would recommend against doing this for the time being — it seems to have hosed my machines recently, hard to say if it’s from the updates or from using this command. I think it’s buggy.

  4. Peter Rose says:

    Somehow I have never known about this, you just made my job a whole lot easier though, thanks a bunch

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site