Homebrew formulae package command-line tools, libraries, and services under the active Homebrew prefix. Installing a formula by token is the normal path for adding a tool such as hello, wget, or git to a macOS, Linux, or WSL Homebrew setup.
A formula token identifies an entry from homebrew/core or another tapped repository. Checking metadata before installation shows the source, dependencies, bottle support, install state, and caveats, which is especially helpful when similar formula and cask names exist.
Formulae usually link executables into the active Homebrew prefix so shell commands become available after installation. Some formulae are keg-only and do not create those links automatically, so read any caveats before treating a successful install as a command on PATH.
Related: How to search for Homebrew packages
Related: How to check Homebrew package information
Related: How to install a Homebrew cask
Related: How to install Homebrew packages from a Brewfile
Steps to install a Homebrew formula:
- Search for the formula token.
$ brew search --formula hello hello jello helm
Use the exact formula token from the result. The --formula option excludes casks from the search result.
Related: How to search for Homebrew packages - Inspect the formula metadata.
$ brew info --formula hello ==> hello: stable 2.12.3 (bottled) Program providing model for GNU coding standards and practices https://www.gnu.org/software/hello/ Not installed From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/h/hello.rb License: GPL-3.0-or-later ==> Dependencies Required (1): bubblewrap ##### snipped #####
Check the package description, install state, source tap, dependencies, and caveats. Dependency lists and bottle architecture can differ between macOS, Linux, and WSL.
Related: How to check Homebrew package information - Install the formula.
$ brew install --formula hello ==> Would install 1 formula: hello ==> Would install 2 dependencies for hello: libcap bubblewrap ==> Fetching downloads for: hello ##### snipped ##### ==> Installing hello ==> Pouring hello--2.12.3.arm64_linux.bottle.tar.gz ##### snipped #####
Homebrew may ask for confirmation before downloading. Add --yes only after reviewing the token and metadata. If the formula is already installed but outdated, brew install can upgrade it unless HOMEBREW_NO_INSTALL_UPGRADE is set.
- Confirm that Homebrew records the installed formula.
$ brew list --formula --versions hello hello 2.12.3
- Check that the installed command resolves from the Homebrew prefix.
$ command -v hello /home/linuxbrew/.linuxbrew/bin/hello
On macOS, the path commonly starts with /opt/homebrew/bin on Apple Silicon or /usr/local/bin on Intel. If another path appears first, reload the Homebrew shell environment.
Related: How to configure Homebrew shell environment - Run the installed command.
$ hello Hello, world!
For a library-only or service formula, replace this smoke test with the package-specific file, header, library, or service check shown by brew info.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.