I often use
dpkg -S <file> on Debian to get the package name that installed
brew I cannot find this option anywhere?
How can I obtain the Brew formula that installed a given binary?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
brew whence external command takes an executable and looks up the Homebrew formula from where the executable comes.
To install the
brew whence command, run:
$ brew tap claui/whence
brew whence, pass it an executable:
$ brew whence python3
Executable Comes from ========== ========== /usr/local/bin/python3 → python 3.7.7
Or pass it several executables at once:
$ brew whence 7z git-shell lzgrep
Executable Comes from ========== ========== /usr/local/bin/7z → p7zip 16.02_2 /usr/local/bin/git-shell → git 2.26.0 /usr/local/bin/lzgrep → xz 5.2.5
For more information and examples, run
brew help whence:
$ brew help whence
Full disclosure: I wrote this command.
It is not part of Homebrew proper but you can inspect the code yourself.