To find where Homebrew installed a dependency on macOS, ask Homebrew for the package’s prefix, then list the files in its current installation. Replace openssl@3 in the commands below with the formula name you need. Homebrew stores formula versions in its Cellar and may link files into a shared prefix, so the package’s install location and the path of a command you run can differ. Homebrew’s brew(1) reference

Find the formula’s installation path

In Terminal, run:

brew --prefix openssl@3

For an installed formula, this prints the location where that formula lives or is linked. If you want Homebrew to report an error when the formula is not installed, use the --installed option:

brew --prefix --installed openssl@3

The result usually uses Homebrew’s stable opt path, such as /opt/homebrew/opt/openssl@3 on many Apple silicon setups or /usr/local/opt/openssl@3 on Intel. These are common defaults, not a guarantee: a Mac can have a custom prefix or multiple Homebrew installations. Check the output on your own machine instead of assuming a path from another Mac. Homebrew documents /opt/homebrew as its default Apple silicon prefix and /usr/local as its default Intel prefix. Homebrew FAQ

See the versioned files and the actual executable

To list paths inside the formula’s current keg—the directory for its installed version—run:

brew list --formula openssl@3

Homebrew defines brew list with a formula argument as a summary of paths within that formula’s current keg. To see the versioned Cellar path itself, combine the formula’s prefix with readlink:

readlink "$(brew --prefix openssl@3)"

The output commonly points into a versioned directory such as ../Cellar/openssl@3/3.x.y. The exact version depends on what is installed. Homebrew describes formula installations as kegs in the Cellar, with some files symlinked into the broader Homebrew prefix. Formula Cookbook

If the question is specifically “Which executable will my shell run?”, check command resolution separately:

command -v openssl

This reports the first matching command found through your current shell’s PATH. It can differ from the formula’s prefix if another installation appears earlier in PATH, or if the formula does not provide a command with that name. To inspect the binary directly, use the path printed by command -v with ls -l to see whether it is a symbolic link. A package may include libraries, headers, and supporting files as well as executables; checking one command does not locate every package file.

If the formula name is unclear or it is missing

List installed formulas with versions, then identify the relevant name:

brew list --formula --versions

Homebrew also distinguishes formulas it considers user-requested from those installed as dependencies. These commands can help narrow down the list:

brew list --formula --installed-on-request
brew list --formula --no-installed-on-request

If brew --prefix --installed NAME reports that the formula is not installed, verify its exact name in brew list --formula --versions. A dependency may have been removed during cleanup, may belong to another Homebrew installation, or may have been installed with a different package manager. If multiple copies of brew are available, command -v brew shows which one your current shell uses; run the package queries through that same brew command.

When the package came from a macOS installer

For software installed by Apple’s Installer app from a .pkg, Homebrew commands do not apply. macOS’s pkgutil can list package IDs and the files recorded for a receipt:

pkgutil --pkgs
pkgutil --files com.example.package

Replace com.example.package with an actual ID from the first command. The --files output comes from Installer’s receipt database; it is not a universal inventory of every package manager’s installs. Package IDs may not match an app’s visible name. Apple pkgutil manual

What the paths do and do not tell you

For a Homebrew formula, brew --prefix NAME is the quick way to find its Homebrew-managed location, and brew list NAME shows paths in its current keg. Use command -v when you need to know which executable your shell selects. These answer different questions: a package’s files can exist even when its executable is absent from PATH, and an executable found on PATH may come from somewhere other than the formula you are inspecting.

If you need a complete file inventory for a package installed another way, use that package manager’s own receipt or listing tools. Do not infer an install location from a package name alone.

Sources