Find the install location of brew on OS X
Categories:
Locating Homebrew's Installation Path on macOS

Discover the various methods to find where Homebrew is installed on your macOS system, essential for troubleshooting and advanced configurations.
Homebrew is an indispensable package manager for macOS, simplifying the installation of software not provided by Apple. While its primary function is to make software management easy, sometimes you need to know its exact installation location. This is crucial for debugging, managing permissions, or integrating with other development tools. This article will guide you through several reliable methods to pinpoint Homebrew's installation directory.
Understanding Homebrew's Default Installation
By default, Homebrew installs itself into /usr/local
on Intel-based Macs and /opt/homebrew
on Apple Silicon (M1/M2/M3) Macs. This distinction is important because the architecture of your machine dictates the primary installation prefix. Knowing this default helps in quickly checking the most common locations.
flowchart TD A[Start] A --> B{Check macOS Architecture} B -->|Intel (x86_64)| C[Default Path: /usr/local/Homebrew] B -->|Apple Silicon (arm64)| D[Default Path: /opt/homebrew] C --> E[End] D --> E[End]
Homebrew's default installation path based on macOS architecture.
Using brew --prefix
for the Definitive Path
The most straightforward and recommended way to find Homebrew's installation prefix is by using the brew --prefix
command. This command directly queries Homebrew itself for its root directory, providing an accurate and dynamic result regardless of your system's architecture or any custom installation paths.
brew --prefix
Executing brew --prefix
to find the installation path.
The output of this command will be the absolute path to your Homebrew installation. For example, on an Intel Mac, it might return /usr/local
, and on an Apple Silicon Mac, it would return /opt/homebrew
.
brew --prefix
in scripts or automated tasks where you need to reference Homebrew's root directory. This ensures compatibility across different macOS versions and architectures.Alternative Methods: which brew
and find
While brew --prefix
is preferred, other command-line utilities can also help locate the brew
executable, which indirectly points to its installation. The which
command shows the full path of the executable that would be run, and find
can search your filesystem.
which brew
Using which brew
to find the executable's location.
The output of which brew
will typically be /usr/local/bin/brew
or /opt/homebrew/bin/brew
. The directory containing bin
is usually the Homebrew prefix. You can then use dirname $(which brew)
to get the parent directory of the executable, and then dirname $(dirname $(which brew))
to get the actual prefix.
find /usr/local -name brew -type d 2>/dev/null
find /opt/homebrew -name brew -type d 2>/dev/null
Using find
to search for the Homebrew directory in common locations.
find
can be slower and less precise than brew --prefix
as it searches the filesystem. It's best used as a fallback or for verifying if Homebrew exists in a non-standard location.