ChatGPT解决这个技术问题 Extra ChatGPT

List all files in a homebrew package

How can I get homebrew to list out all files installed for a package? For example, when I run brew list for the exim package, I get these files:

$ brew list exim
/usr/local/Cellar/exim/4.80.1/bin/exiwhat
/usr/local/Cellar/exim/4.80.1/bin/exiqsumm
/usr/local/Cellar/exim/4.80.1/bin/exiqgrep
/usr/local/Cellar/exim/4.80.1/bin/exipick
/usr/local/Cellar/exim/4.80.1/bin/exinext
/usr/local/Cellar/exim/4.80.1/bin/eximstats
/usr/local/Cellar/exim/4.80.1/bin/exim_tidydb
/usr/local/Cellar/exim/4.80.1/bin/exim_lock
/usr/local/Cellar/exim/4.80.1/bin/exim_fixdb
/usr/local/Cellar/exim/4.80.1/bin/exim_dumpdb
/usr/local/Cellar/exim/4.80.1/bin/exim_dbmbuild
/usr/local/Cellar/exim/4.80.1/bin/exim_ctl
/usr/local/Cellar/exim/4.80.1/bin/exim_checkaccess
/usr/local/Cellar/exim/4.80.1/bin/exim-4.80.1-3
/usr/local/Cellar/exim/4.80.1/bin/exim
/usr/local/Cellar/exim/4.80.1/bin/exigrep
/usr/local/Cellar/exim/4.80.1/bin/exicyclog
/usr/local/Cellar/exim/4.80.1/share/man/man8/exim.8

But there are files added to the system that is not in the list above. For example:

$ ls -ld /usr/local/etc/exim.conf 
-rw-r--r--  1 hanxue  admin  35904 Sep 25 21:11 /usr/local/etc/exim.conf

k
kenorb

Just add -v or --verbose, for example:

$ brew ls --verbose exim

While that recurses into installed directories and lists all the files they contain, it did not list the exim.conf file in the original post. It was added by the brew install action.
@MSpreij MacPorts actually does not have this problem since it tracks all files that will be installed before moving them into their final destination. Homebrew does not do this at all, so config files under /usr/local/etc and other places are there to stay unless one manually removes them. Homebrew only concerns itself with the program, not the settings or other remnants that the program leaves behind. Here is a section from the MacPorts documentation explaining how they avoid this problem.
Or brew ls -v exim for short.
P
Pierz

If the package in question is a cask install (e.g. mactex) then you'll need to include the --cask arg to the list/ls command e.g.

brew ls --cask exim

Note: With casks if you don't include the --cask arg then it often reports an error. And with the --cask arg it may only list the installer dmg as it doesn't seem to track the resulting installed files.