Skip to main content

Homebrew - The Missing Package Manager

Posted March 2024 by Steve Sinchak

Software packages on Linux or Unix are typically distributed and installed from repositories using a special utility called a package manager. This utility simplifies the installation of a package and makes sure all the dependencies of the software are also met and installed. In addition, the package manager makes it easy to install updates or remove the software package. While macOS is a descendant of Unix, it has no package manager so installing, updating, and removing software can be a manual chore.

Calling itself "the missing package manager for macOS," Homebrew was created to solve this problem and also includes repositories (with the capability to add more repositories) that make it easy to install many of the most popular Linux/Unix apps on your Mac. Which is especially helpful for configuring your development environment!

Homebrew Terminology

If you are familiar with the APT package manager on Linux, you may find the terminology of Homebrew a little confusing. Following the beer-brewing theme, there are many special terms:

  • Formula / Formulae: Package that builds/compiles from upstream sources. Often these are command-line tools such as wget, python, git.

  • Cask: Package that installs native pre-compiled apps. E.g. vlc, slack, chrome.

  • Taps: Package Repositories where the Formulas or Casks come from. By default, you get homebrew/cask and homebrew/core but you can add more.

  • Prefix: Location where Homebrew is installed.

  • Caskroom: Install location for Casks.

Some terms just about Formulas:

  • Keg: Install location for a specific version of a Formula.

  • Rack: Location of Kegs.

  • Cellar: Location of Racks.

  • Bottle: Pre-compiled Keg (a specific version of a Formula) "poured" into a Rack instead of compiling from an upstream source. Think of this as a variant of a Formula that was pre-compiled to save you time of compiling it yourself.

If these terms are very confusing, don't worry, you only need to know a few simple commands to actually use Homebrew which I will cover next. But when you are running Homebrew commands, you will see the terms above in the terminal output so I hope the additional context and definitions are helpful.

How to Install Homebrew

Installing Homebrew itself is incredibly simple. Open up Terminal, paste in the command below, and hit return to run the installation shell script. If you would like to see what the script is going to do, click here to view it now.

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

If you ever want to uninstall Homebrew, just run the uninstall script:

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

How to Find Homebrew Packages

There is also a search command built into Homebrew that you can use by running brew search <search term>.

Example searching for "python" packages:

stevesinchak@tweaks dev % brew search python
==> Formulae
app-engine-python          python-idna                python-setuptools-scm
boost-python3              python-jinja               python-sympy
bpython                    python-kiwisolver          python-tabulate
cyclonedx-python           python-launcher            [email protected]
ipython                    python-lsp-server          [email protected]
meson-python               python-lxml                [email protected]
micropython                python-mako                [email protected]
ptpython                   python-markdown            python-toml
python-argcomplete         python-markupsafe          python-trove-classifiers
python-brotli              python-matplotlib          python-typing-extensions
python-build               python-mpmath              python-urllib3
python-certifi             python-mutagen             python-yq
python-chardet             python-networkx            [email protected]
python-charset-normalizer  python-packaging           [email protected]
python-click               python-pathspec            [email protected]
python-cryptography        python-pluggy              [email protected]
python-cycler              python-ply                 [email protected]
python-dateutil            python-psutil              [email protected]
python-filelock            python-pyparsing           reorder-python-imports
python-flit-core           python-pyproject-hooks     wxpython
[email protected]           python-pytz                pythran
[email protected]           python-requests            jython
python-hatchling           python-setuptools          cython

==> Casks
mysql-connector-python

If you meant "python" specifically:
It was migrated from homebrew/cask to homebrew/core.

How to Install Homebrew Packages

Simply run brew install <package>

Example that will install the wget package:

stevesinchak@tweaks dev % brew install wget
==> Downloading https://formulae.brew.sh/api/formula.jws.json
############################################################################################################ 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
############################################################################################################ 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/wget/manifests/1.21.4
############################################################################################################ 100.0%
==> Fetching dependencies for wget: libunistring, gettext and libidn2
==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/manifests/1.2
############################################################################################################ 100.0%
==> Fetching libunistring
==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/blobs/sha256:4a1c0f956e528e0fe9a5040da6a2002e22102483
############################################################################################################ 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.22.5
############################################################################################################ 100.0%
==> Fetching gettext
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/blobs/sha256:4b5b6cb0692b4606b9220fcbc9da3ab546234348dc87e
############################################################################################################ 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libidn2/manifests/2.3.7
############################################################################################################ 100.0%
==> Fetching libidn2
==> Downloading https://ghcr.io/v2/homebrew/core/libidn2/blobs/sha256:670f6ed3768acde8ce10b5dcfc88fef69cea994ff8449
############################################################################################################ 100.0%
==> Fetching wget
==> Downloading https://ghcr.io/v2/homebrew/core/wget/blobs/sha256:47cb2b77bcb48ee8d8b8fb222bcafe0febe11195ac647640
############################################################################################################ 100.0%
==> Installing dependencies for wget: libunistring, gettext and libidn2
==> Installing wget dependency: libunistring
==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/manifests/1.2
Already downloaded: /Users/stevesinchak/Library/Caches/Homebrew/downloads/48ac60445a77a63996cf15f6414f68a620d544fb683031b14eb3aea95c3064f6--libunistring-1.2.bottle_manifest.json
==> Pouring libunistring--1.2.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libunistring/1.2: 59 files, 5MB
==> Installing wget dependency: gettext
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.22.5
Already downloaded: /Users/stevesinchak/Library/Caches/Homebrew/downloads/447e45b77bb47ede0377f7eab1863825298ecaaaeed0bbd84aca3bd300b00508--gettext-0.22.5.bottle_manifest.json
==> Pouring gettext--0.22.5.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/gettext/0.22.5: 2,043 files, 24.4MB
==> Installing wget dependency: libidn2
==> Downloading https://ghcr.io/v2/homebrew/core/libidn2/manifests/2.3.7
Already downloaded: /Users/stevesinchak/Library/Caches/Homebrew/downloads/45d1d4d2930c4782bf53e761a1c0166cd8a40f4193ac8c44e86f0b6708e80354--libidn2-2.3.7.bottle_manifest.json
==> Pouring libidn2--2.3.7.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libidn2/2.3.7: 80 files, 1MB
==> Installing wget
==> Pouring wget--1.21.4.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/wget/1.21.4: 91 files, 4.4MB
==> Running `brew cleanup wget`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

If you want to install a specific package version run: brew install <package>@<version>

How to List all installed Homebrew Packages

To see all of the packages you installed with Homebrew, run brew list ; brew list --cask

stevesinchak@tweaks dev % brew list ; brew list --cask 
==> Formulae
ca-certificates	libidn2		    m4		    msodbcsql17	mssql-tools18	sqlite		xz
gettext		    libtool		    mkcert		msodbcsql18	openssl@3	    unixodbc
iperf3		    libunistring	mpdecimal	mssql-tools	readline	    wget

This is helpful if you need a reminder of an official package name for use with the update or uninstall commands.

How to Uninstall Homebrew Packages

Run brew uninstall <package name>

Example removing the "wget" package we installed earlier:

stevesinchak@tweaks dev % brew uninstall wget
Uninstalling /opt/homebrew/Cellar/wget/1.21.4... (91 files, 4.4MB)

Warning: The following may be wget configuration files and have not been removed!
If desired, remove them manually with `rm -rf`:
  /opt/homebrew/etc/wgetrc

Sometimes configuration files will remain behind but the details of how you can remove them will be provided in the warning section. In this case, I needed to run rm -rf /opt/homebrew/etc/wgetrc to delete the configuration files.

How to Update Packages Installed by Homebrew

First, like any package manager, you need to update your repositories by running brew update

Then you can run brew outdated to view packages that have an update available.

stevesinchak@tweaks dev % brew outdated
microsoft/mssql-release/msodbcsql17 (17.10.4.1) < 17.10.5.1
microsoft/mssql-release/msodbcsql18 (18.3.1.1) < 18.3.2.1

If you want to apply all updates, just run brew upgrade

But you can also upgrade just a specific package by running brew upgrade <package name>

I strongly recommend running brew update and brew upgrade once a month to keep your Mac updated and protected. You could also combine the two commands into brew update && brew upgrade. This is very important because vulnerabilities are discovered all the time and it is easy to forget about the command line tools we install. Apple security updates protect the operating system and the Apple apps, but it is up to you to keep your Homebrew fresh!

Happy Brewing!

Related Posts


Whether you write code professionally or just as a hobby, static code analysis is an important tool for any developer to find bugs, security vulnerabilities, and opportunities to improve the quality of your code. The most popular tool is called Sonarqube which offers a free open-source community edition that can be installed locally and supports most of the popular languages. While it does not have...

Read More