Skip to content

Installing Homebrew

Ryan Parman edited this page Nov 7, 2024 · 6 revisions

Homebrew is a third-party package manager for macOS. It is used primarily for installing command line software, although it can also be used to install desktop applications. Alternate (and less commonly used) package managers for macOS include MacPorts and Fink.

Important

Installed packages and their versions are available globally across the whole system.

It is analogous to package managers such as yum, dnf, apt-get, or others in Linux. Also Windows Package Manager or Chocolatey in Windows.

Installing Homebrew

The Homebrew website provides a pretty good explanation of how to install and how it generally works.

  1. Install Homebrew.

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Add the following environment variable definition to your shell's profile.

    export HOMEBREW_CASK_OPTS="--no-quarantine"

The Homebrew Manual provides deeper technical details and information.

Installing packages from Homebrew

For example, let's say you want to install the latest release of Python, but you're not sure what the name of the package is. You can search for the keyword.

$ brew search python

==> Formulae
boost-python3                     python-setuptools
bpython                           python-tabulate
cyclonedx-python                  python-tk@3.10
ipython                           python-tk@3.11
libvirt-python                    python-tk@3.12
micropython                       python-tk@3.13
ptpython                          python-tk@3.9
python-argcomplete                python-yq
python-build                      python@3.10
python-gdbm@3.11                  python@3.11
python-gdbm@3.12                  python@3.12
python-gdbm@3.13                  python@3.13
python-launcher                   python@3.8
python-lsp-server                 python@3.9
python-lxml                       reorder-python-imports
python-markdown                   wxpython
python-matplotlib                 pythran
python-packaging                  cython
python-ply                        jython

==> Casks
mysql-connector-python

From here, we can see that the latest release of Python is python@3.13. So let's install it.

brew install python@3.13

Homebrew will automatically handle installation, as well as adding it to your $PATH so that it shows up when you begin typing the name, then hit Tab to auto-complete the command name.

Re-installing packages from Homebrew

If something about your installation gets messed-up, you can try reinstalling it from scratch.

Tip

This only works for packages that are already installed.

brew reinstall python@3.13

Uninstalling packages from Homebrew

If you want to remove a piece of software (or a version of software which contains an @ in the name), use the uninstall sub-command.

brew uninstall python@3.13