If you manage a bunch of Macs as an administrator, you likely need to update their software regularly. While macOS Server offers some tools to handle this, there are also some Terminal commands to help you along. We can use some system commands and open-source repositories to update Mac apps using Terminal.
Update Built-In Mac Apps Using Terminal
To update built-in software and Apple utilities, we’ll use the softwareupdate
command.
1. Open Terminal (Application/Utilities/Terminal.app).
2. To see all the built-in software available for update, type the following command and press “Enter:”
softwareupdate -l
This will list all the macOS software updates that are currently available for your system.
3. Wait for a moment while it searches the macOS servers for updates.
4. After it fetches all the relevant information, softwareupdate
will tell you which updates are available. If no updates are available, you’ll be returned to the command prompt without any kind of status message.
5. To update everything that’s available to be updated, type the following command and press “Enter:”
sudo softwareupdate -ia --verbose
6. When asked, type your password and press “Enter.”
7. Now the update process will do it’s thing, displaying its status (including application name) as it goes.
8. Once all the updates are installed, you’ll be sent back to the command prompt.
Softwareupdate Flags
- The
--verbose
flag, like all verbose flag, spits out a bunch of status updates as the command does its thing. It’s totally optional, but it can help you make sure the command is doing the right thing and not hanging on some process for some reason. It’s especially useful if you have a ton of updates to process. - The
-i
flag stands for “install” and like the name suggests, it will install whatever update you specify or, with the-a
flag, all updates. - To use the -i flag to install just one update, type
softwareupdate -i [package name]
For example,softwareupdate -i RemoteDesktopClient-3.9.2
will install only the RemoteDesktopClient 3.9.2 update. - The
-a
flag stands for “all.” This will apply your commands to all available application updates. - The
-r
flag stands for “recommended.” For example,softwareupdate -ir
will install only “recommended” updates. Recommended updates are those that are important for the health and security of your Mac, and typically require a restart. - The
-h
flag stands for “help” and will show all the commands available under the command. - If there’s an update you don’t want to install, you can ignore it. To ignore specific updates, use the
--ignore
flag followed by the name of the package. For example:
softwareupdate --ignore RemoteDesktopClient-3.9.2
will hide the 3.9.2 update of RemoteDesktopClient. You’ll still be alerted the next time an update is available, but the--ignore
flag allows you to skip a version.
Update Mac App Store Apps Using Terminal
By default, macOS does not contain a command line utility for updating apps from the Mac App Store. All updated are handled through the GUI of the App Store app. But for some power users, this is a bit of a drag. To get around this limitation, However, you can install Dmitry Rodionov’s mas utility from Homebrew to add this functionality to your command line.. This app adds a new command to your Terminal, allowing you to update apps via the command line. It’s fully-scriptable, but not nearly as complex or interactive as Apple’s own softwareupdate
. As a bonus, you can also run other Mac App Store commands, like searching for apps and installing apps, making it easier to administer a computer over SSH.
1. Open Terminal (Application/Utilities/Terminal.app).
2. The software will be installed via Homebrew, which is a package manager for the Mac that can install new Terminal commands.
If you haven’t yet installed Homebrew on your Mac, you’ll need to get it up and running. Copy and paste the Terminal command below to install Homebrew.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
You can also follow our guide for getting set up with Homebrew.
3. Once you’ve got Hombrew installed, you can grab the Mac App Store command line utility by using the following command:
brew install mas
4. After Homebrew finishes installing the Mac App Store command line utility, you can type in mas
to see a list of all available mas
commands. As you can see, there’s commands for most basic Mac App Store functionalities, like updating and signing in.
5. Not every program on your computer is from the Mac App Store. You might have downloaded DMGs or package installers for some popular apps, like Google Chrome. To see everything that’s installed on your computer via the Mac App Store, use the list
command, as see below:
mas list
6. To see which apps have upgrades available, use the outdated
command, as see below:
mas outdated
7. You can use the upgrade
command to update all Mac App Store apps like so:
mas upgrade
8. Once you run the upgrade
command, mas will look for updates for every app on your computer from the Mac App Store. If it finds any, it will automatically download and install the upgrades without any further interaction.
9. After the update process is finished, you’ll be returned to your normal command prompt with a Mac full of up-to-date apps.
You might also like: