At installation, all Macs contain a wide variety of Terminal commands. However, as you get more experience with Terminal (or if you’re joining us from Linux), you might soon find that some important commands are missing. Where’s
wget, for example, or
nmap? If you need those commands, you can easily add them to the macOS Terminal with a package manager.
A package manager is an application that handles downloading, installing, and upgrading a set of software tools. In this case, our package manager will be responsible for downloading and installing the different Terminal commands that we want to use. If you’re a Linux user, you’ll recognize this functionally from
While there are a number of different package managers available for macOS, we’ll use Homebrew for this guide. It’s well regarded, widely used, and easy to get started with. Plus, it’s free.
Note that before you install Homebrew, you’ll need to have the Xcode command line tools installed. This comes with Xcode which is installed from the App Store.
1. Open Terminal (/Application/Utilities/Terminal.app).
2. Copy and paste the following command into Terminal and press Enter.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
This command will run a Ruby script that downloads the Homebrew package manager from GitHub.
3. When prompted, press Enter to continue the installation.
4. Enter your administrator password when prompted.
5. When the application is finished installing, you’ll be returned to the command prompt. From here, you can view Homebrew’s documentation by typing the
brew help command, or you can proceed to the next step.
Searching for Packages
To find programs and commands to download, you’ll first need to search Homebrew’s database for the program you want. For this example, we’ll search for
Wget is a popular Linux command that downloads files from HTTP and FTP servers.
1. Type the following command and press Enter:
brew search wget
2. After a moment, two results will appear named
wgetpaste. I don’t know what
wgetpaste is, but I can find more info using the
brew info command:
brew info wgetpaste
3. We can see from the description that
wgetpaste will “Automate pasting to a number of pastebin services.” Since
wget is an application that downloads files from the Web, that doesn’t sound like what I’m looking for. It also includes
wget as a dependency, so I wouldn’t be able to run it without
1. Now that I’ve confirmed that the
wget package is the one I want, I’ll type in the following command and press Enter:
brew install wget
2. Homebrew will now start to work its package-managing magic. In addition to
wget, I can see that it also installed
openssl, which is considered a dependency for
3. When the installation is complete, I’ll be returned to the command prompt.
Using new commands
Now that we’ve installed the
wget command, we’ll be able to use it just like any other Terminal command.
1. For example, if we type
man wget, we’ll see the man page for
wget, just as expected.
2. And we can use
wget just as we would on Linux. For example, to download a zip file from a website, we’d use a command like the one below:
3. Here’s a real life example of a texture pack I downloaded from TextureMate.
And when the download is completed, I’m returned to the command prompt.
As you become more experienced with macOS’s terminal, you may begin to realize that some Terminal commands that are common in Linux are missing from macOS. It’s easy to add new Terminal commands to your command library using Homebrew.