How to determine which brew package provides a given file?
There is not. Nothing in Homebrew maintains a list of files that a package is allowed or expected to install.
While there is not apt-search like tool that allows one to find public homebrew packages that could provide a file, many brew packages are based on a linux or unix counterpart. You can search the Debian package website to find the needed package.
Example for finding package that provides file goocanvas.pc
https://packages.debian.org/search?suite=default§ion=all&arch=any&searchon=contents&keywords=goocanvas.pc
Returns libgoocanvas-dev
brew search
has no results for libgoocanvas-dev or libgoocanvas but it does have a goocanvas package.
You can define a command ineed
as follows that would return a list from debian.org using ineed goocanvas.pc
:
ineed() {
echo -en $(echo \
$(curl -s "https://packages.debian.org/search?suite=default§ion=all&arch=any&searchon=contents&keywords=$1") \
| sed 's%</*tr>%\\n%g') \
| grep 'class="file"' \
| sed 's/<[^>]*>//g' \
| column -t \
| grep --color -i -w "$1"
}
As stated in this answer you can do ls -l /usr/local//lib/whatever
and see where the symlink points to.