Macos Update Terminal


Every once in a while, you’ll find that an update is available for either your macOS system or the apps installed on your machine. It’s important that you keep your system software and apps up to date. This ensures your system is stable and your apps are bug-free.

On a Mac machine, you have several ways to update the operating system and applications. The traditional way to get and install new updates is to use the official Mac App Store on your machine.

UPDATE: This method does not work on macOS Big Sur. It can only be used on Catalina and older. When a freshly built or rebuilt Mac gets to the “country choice” screen as part of Setup Assistant, and is connected to a network, the device checks in with Apple to see if it is assigned to be enrolled to an MDM service using Automated Device Enrollment (what we used to call DEP). Once Terminal is open, type the following command: softwareupdate -l. Your Mac will search Apple’s servers for any macOS updates currently available. If there aren’t any updates available, it. Mar 31, 2017 Update Mac App Store Software Using Terminal By default, macOS does not contain a command line utility for updating apps from the Mac App Store. However, you can install Dmitry Rodionov’s mas utility to add this functionality to your command line. I am accustomed to updating systems with sudo apt get update and would like to ensure MacOS security updates are installed from the command line. This `software update' command was issued on my machine: $ softwareupdate -l Software Update Tool Finding available software No new software available. The article indicates that the unix equivalent is.

However, you’re not tied to it to install your updates. You can also use the Terminal app to find, download, and install various updates on your machine. There are even configurable options letting you decide how these updates should be installed.

Update The macOS Version From Terminal

Terminal has a command that checks for all the available updates for macOS and allows you to download and install them on your machine. The command also lets you update Apple apps such as iTunes on your Mac.

What it doesn’t do though is to install updates for the third-party apps installed on your machine. For those apps, you’re going to need to install a package that is described in the later part of this guide.

Find Available macOS System Updates

Macos check updates terminal

The first thing you’ll want to do is check what updates are available for your macOS and Apple apps. Checking doesn’t necessarily mean downloading or installing updates. It’s just to give you an idea what needs to be updated on your Mac.

Launch the Terminal app using your preferred method on your Mac.

When the app launches, type in the following command and press Enter.
softwareupdate -l

It’ll look for all the available updates and display them in your Terminal window. The information you’ll see include the app names, size of the update, whether the update is recommended or not, and whether the update requires rebooting your machine.

You can also check the updates with Terminal and then install them from the App Store, if you want to do it that way.

Download macOS System Updates

After finding out what updates are available, you might want to download those updates to your Mac. Keep in mind that downloading also doesn’t require you to install the updates. You can just keep the updates downloaded and not install them right away.

  • Launch the Terminal app and type in the following command and hit Enter.
    softwareupdate -d -a
  • It’ll download all the available updates but won’t install them. You’ll find these update files in the /Library/Updates/ folder on your Mac.

Mac Os Update Terminal

Install Downloaded macOS Updates

The updates you download using the Terminal command can’t be manually installed. These updates can only be installed using a command in the Terminal app.

To install them, you need to first find out the name of the update and then use that name below to get the update installed on your Mac.

  • Launch the Terminal app, type in the following command, and hit Enter. Make sure to replace update-name with the name of the update you wish to install.
    softwareupdate -i update-name

It’ll let you know when the update is installed on your machine. This shouldn’t take too long as the update is already downloaded on your Mac and it just needs to be installed.

Download & Install All macOS Updates

What you did in the above sections was update things bit by bit. What if you want to find, download, and install all the macOS updates in one go? Well, Terminal has you covered.

There’s a command that lets you install all the available updates on your Mac in a single execution.

  • Open the Terminal app and run the following command in it.
    softwareupdate -i -a

The command will get all updates installed and let you know when it’s done. This’ll take longer than the above methods as it first downloads all the updates and then installs them one by one on your machine.

Update Mac Apps From Terminal

Third-party apps that aren’t developed by Apple require different commands to be updated from the Terminal on your Mac. These app updates won’t show up when you run the commands mentioned above.

In order to be able to update all of your Mac Store Apps, you’re going to need to install Homebrew followed by ‘mas’ on your machine. It’ll then let you update your other apps.

Open the Terminal app and run the following command in it to install Homebrew.
/usr/bin/ruby -e “$(curl -fsSL”

When Homebrew is installed, type in the following command and press Enter to install the mas utility.
brew install mas

When mas is installed, you can run the following command to see a list of all the apps that can be updated using this utility.
mas list

Type in the following command and press Enter to see all the apps that require an update.
mas outdated

Run the following command to update all the outdated apps. It’ll first download updates for all the outdated apps and then install them so expect a good amount of time before it finishes.
mas upgrade

Wait while the utility updates your apps. When it’s done, you can close the Terminal window.

You don’t necessarily need to keep mas and Homebrew installed on your Mac if you don’t plan to update your apps using this way in the future. Uninstalling them won’t affect the updated apps on your Mac so it’s safe to remove them if you want.

The process of setting environment variables in the Terminal will be familiar to those with experience with Linux or UNIX. It involves editing files in /etc for global environment variables, and in your home directory for user specific environment variables.

Login shell vs non-login shell

A login shell is the shell that is started when you open a new terminal window. A non-login shell is when you start a sub-shell in the window, for example, typing bash when you have the bash shell running already.

Global PATH only

If you just want to edit the global PATH variable, you can put a file in /etc/paths.d with the path you want to add. For example, we will create a file /etc/paths.d/ec2-api-tools and put the following in:


Open a new Terminal and $PATH will reflect the change.

Macos Update Terminal


Setting environment variables

The format for setting an environment variable in the bash shell is KEY=value with no spaces around the equal sign. In addition, when putting it in a configuration file it is necessary to prepend it with export. The following is an example of how to set an environment variable in one of the configuration files, it also works on the command line; we will set the variable JAVA_HOME to /Library/Java/Home:

Login shell

First /etc/profile, then whichever of the following exists, trying them in order: ~/.bash_profile, ~/.bash_login, or ~/.profile

Non-login shell


/etc/bashrc, then ~/.bashrc

Have login shell read /etc/paths and /etc/paths.d

Have login shell read /etc/bashrc and ~/.bashrc

Macos Update Terminal

Setup /etc/profile.d


The following is the collection of all the changes above along with links to download them:


Macos Update Terminal

Setting environment variables

For the tcsh shell, the format for setting an environment variable is setenv KEY value. The following is an example which will set the JAVA_HOME variable to /Library/Java/Home.

Macos Update Java Terminal

Login shell

First /etc/csh.cshrc, then /etc/csh.login, then whichever of the following exists, trying in order: ~/.tcshrc, ~/.cshrc; then finally ~/.login.

Macos Terminal Update Time

Non-login shell

First /etc/csh.cshrc, then whichever of the following exists, trying in order: ~/.tcshrc, ~/.cshrc.


Parts of this series

  • HowTo: Set an Environment Variable in Mac OS X - Terminal Only