How to install Homebrew on macOS step by step

Homebrew is installed on a Mac via the terminal. You’ll need the Xcode development software for some packages. After successful setup, you can easily use the package manager for all programs.

How to install Homebrew on a Mac

The free and open-source solution Homebrew is a very useful extension, especially for developers, to install software packages and binary applications or to set up a test environment for new programs or websites. Installing Homebrew on a Mac is a little more complex, which is why we’ll guide you through all the necessary steps in the following sections.

Compute Engine
The ideal IaaS for your workload
  • Cost-effective vCPUs and powerful dedicated cores
  • Flexibility with no minimum contract
  • 24/7 expert support included

What are the system requirements?

The package manager stores all installation files in the /usr/local/bin or /usr/local/Cellar folders. However, the link is made with /usr/local/bin. There are a few basic requirements that must be met to install Homebrew on a Mac, which are:

  • An internet connection
  • A computer with macOS Mojave (10.14) or later
  • Apple Silicon or 64-bit Intel CPU
  • Xcode with CLT
  • A Bourne compatible shell
  • Admin rights

A step-by-step guide to installing Homebrew

You install Homebrew on a Mac via the command line. The following steps are necessary for this:

  1. Open the terminal. This can be found in the Applications folder and the Utilities subfolder. Alternatively, press the Mac shortcut [Command] + space bar and enter the search term “Terminal” in the search field.
  2. You then install the Xcode development environment via the command line. This allows you to create apps for Apple devices. The appropriate command is this one:
xcode-select --install
bash

Then confirm the installation and further queries.

  1. Now install Homebrew. The necessary command (for all supported macOS versions) is as follows:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
bash

Confirm the Homebrew installation with [Enter]. Enter your admin password and confirm this as well. If the installation was successful, a corresponding message will appear.

How to manually install Homebrew on a Mac

Alternatively, you also have the option of installing Homebrew manually on macOS. To do this, first write a command to download the install script. Then execute another command to initiate the script. The necessary steps in the command line are as follows:

  1. Download the script with this command:
curl -fsSL -o install.sh https://raw.githubusercontent.com/Homebrew/install/master/install.sh
bash
  1. Use the following command to view the code of the script. This way you can make sure that everything is as you want it.
less install.sh
bash
  1. Now install the script with the following command:
/bin/bash install.sh
bash

You’ll now need to confirm some information. Your system requirements will then be checked and you’ll be asked to enter your password. Confirm this with [Y].

  1. To make sure that the installation of Homebrew was successful, use this command to call up the status:
brew doctor
bash

If everything is in order and your packages are up to date, you will receive this feedback:

Your system is ready to brew.
bash

How to configure the package manager

After installing Homebrew on your Mac, you can use the package manager at any time to add software packages. For further information, the help command is recommended. It looks like this:

brew help
bash

If you would like to add a specific package, you can search for it using the search command. To do this, simply replace the placeholder “Package name” in the following command with the name of the program you are looking for.

brew search package name
bash

If you don’t want analysis data to be collected and sent, deactivate it with the following command:

brew analytics off
bash

How to get started with packages

If you want to install, update or delete packages with Homebrew, only short commands are required. Use the following command to add packages, replacing the “Package name” placeholder:

brew install package name
bash

If you want to delete a package, use the following command and replace “Package name” with the software you want to uninstall:

brew uninstall package name
bash

If you want to update Homebrew, this is the right command:

brew update
shell

How to uninstall Homebrew on macOS

If you no longer have any use for the package manager, you can easily uninstall Homebrew at any time. The appropriate command is:

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

Alternatively, use the homebrew script uninstall.sh and delete the package manager manually. Execute the script with the following command:

curl -fsSL -o uninstall.sh https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh
bash

Then initiate the uninstallation of Homebrew with this instruction:

bash uninstall.sh
bash

What alternatives to Homebrew are there?

If you don’t want to use Homebrew but are looking for another package manager instead, there are some very good options. Here are three of the best alternatives:

  • MacPorts: The free and open-source MacPorts package manager has been around since 2002. It was originally developed under the name DarwinPorts and is intended to facilitate the installation of other open-source programs. In contrast to Homebrew, MacPorts does not use the system programs.
  • Fink: Fink package management is compatible with other Unix variants and works on the Darwin operating system. The program can be controlled via the terminal, although there is also a graphical user interface with Fink Commander as an alternative. In addition, Fink can be used to adapt the source code.
  • ServBay: ServBay has also been specially developed for use on macOS and is particularly suitable as an alternative test environment. Web servers, databases and other tools can be integrated with just a few instructions. The work is not carried out via the command line, but via a clear user interface.
Was this article helpful?
We use cookies on our website to provide you with the best possible user experience. By continuing to use our website or services, you agree to their use. More Information.
Page top