Homebrew is installed on a Mac via the terminal. You’ll need the Xcode de­vel­op­ment software for some packages. After suc­cess­ful 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, es­pe­cially for de­velopers, to install software packages and binary ap­plic­a­tions or to set up a test en­vir­on­ment for new programs or websites. In­stalling 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
  • Flex­ib­il­ity with no minimum contract
  • 24/7 expert support included

What are the system re­quire­ments?

The package manager stores all in­stall­a­tion 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 re­quire­ments that must be met to install Homebrew on a Mac, which are:

  • An internet con­nec­tion
  • A computer with macOS Mojave (10.14) or later
  • Apple Silicon or 64-bit Intel CPU
  • Xcode with CLT
  • A Bourne com­pat­ible shell
  • Admin rights

A step-by-step guide to in­stalling 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 Ap­plic­a­tions folder and the Utilities subfolder. Al­tern­at­ively, press the Mac shortcut [Command] + space bar and enter the search term ‘Terminal’ in the search field.
  2. You then install the Xcode de­vel­op­ment en­vir­on­ment via the command line. This allows you to create apps for Apple devices. The ap­pro­pri­ate command is this one:
xcode-select --install
bash

Then confirm the in­stall­a­tion 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 in­stall­a­tion with [Enter]. Enter your admin password and confirm this as well. If the in­stall­a­tion was suc­cess­ful, a cor­res­pond­ing message will appear.

How to manually install Homebrew on a Mac

Al­tern­at­ively, you also have the option of in­stalling 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 in­form­a­tion. Your system re­quire­ments will then be checked and you’ll be asked to enter your password. Confirm this with [Y].

  1. To make sure that the in­stall­a­tion of Homebrew was suc­cess­ful, 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 in­stalling Homebrew on your Mac, you can use the package manager at any time to add software packages. For further in­form­a­tion, the help command is re­com­men­ded. 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 place­hold­er ‘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, de­ac­tiv­ate 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’ place­hold­er:

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 ap­pro­pri­ate command is:

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

Al­tern­at­ively, 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 un­in­stall­a­tion of Homebrew with this in­struc­tion:

bash uninstall.sh
bash

What al­tern­at­ives 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 al­tern­at­ives:

  • MacPorts: The free and open-source MacPorts package manager has been around since 2002. It was ori­gin­ally developed under the name Dar­win­Ports and is intended to fa­cil­it­ate the in­stall­a­tion of other open-source programs. In contrast to Homebrew, MacPorts does not use the system programs.
  • Fink: Fink package man­age­ment is com­pat­ible with other Unix variants and works on the Darwin operating system. The program can be con­trolled via the terminal, although there is also a graphical user interface with Fink Commander as an al­tern­at­ive. In addition, Fink can be used to adapt the source code.
  • ServBay: ServBay has also been specially developed for use on macOS and is par­tic­u­larly suitable as an al­tern­at­ive test en­vir­on­ment. Web servers, databases and other tools can be in­teg­rated with just a few in­struc­tions. The work is not carried out via the command line, but via a clear user interface.
Go to Main Menu