Getting Started with Homebrew: The Basics of macOS Package Management


Homebrew (also known as brew) is a free and open-source software package management system designed to simplify the installation of software on Apple’s macOS operating system. It’s known as the “missing package manager for macOS” and allows users to install, update, and remove software right from the Terminal speedily. Homebrew has become so popular that it’s been ported to Linux.

Installing Homebrew

Before installing Homebrew, you’ll need to make sure that you have a compatible version of macOS and Command-Line Tools for Xcode installed on your Mac.

Installing Homebrew on Apple Silicon

Installing homebrew will work on your Mac, regardless of whether you have an Intel or an Apple Silicon (M1 or M2) processor.

Installing Xcode command-line tools

If your system isn’t currently equipped with Xcode or its corresponding command-line tools, there’s no need to worry. You won’t need to install Xcode and instead you can conveniently install the necessary command-line tools using the xcode-select command:

xcode-select --install

Should you unintentionally run this command while the tools are already installed, rest assured, it won’t cause any disruption to your existing setup.

Once you’re ready, you can install Homebrew by pasting the following command into your Terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

This script will explain what changes it will make and prompt you before the installation process begins.

Check if Homebrew is installed

Once the installation is complete, you can type brew in the Terminal to ensure that Homebrew has been installed correctly.

A longer test would be to use brew doctor to perform a more in-depth test of the installation. This is also useful if, in the future, you believe that something has gone wrong with your installation of Homebrew.

Using Homebrew

To install a package with Homebrew, you use the brew install command, followed by the name of the package you want to install. For example, to install the wget package, you would type:

brew install wget

Homebrew will then download the files and install the software for you.

To update a package that you’ve installed with Homebrew, you can use the brew upgrade command followed by the name of the package. If you want to update all your Homebrew packages at once, simply type:

brew upgrade

If you want to remove a package that you’ve installed with Homebrew, use the brew uninstall command followed by the name of the package.

brew uninstall wget

Homebrew Cask

In addition to command-line utilities and applications, Homebrew also includes support for graphical applications through an extension known as Homebrew Cask. Homebrew Cask allows you to install full applications straight from the command line, such as Google Chrome or Visual Studio Code.

brew install --cask google-chrome

Conclusion

Homebrew is a powerful tool that makes managing software on your Mac much easier. Whether you’re installing command-line utilities or full applications, Homebrew can help you streamline your software management process. With a bit of practice, you’ll find yourself using Homebrew as an integral part of your macOS experience.

Remember, the key to becoming proficient with Homebrew, as with any tool, is consistent practice and exploration. So, dive in, and start experimenting with different packages and applications to see just how much Homebrew can enhance your productivity.

Daniel

Whilst building web applications, Daniel also sets up web servers from scratch because he has yet to find the perfect hosting solution. His philosophy is “Why settle, when you can build it better yourself?”

Recent Posts