Some Homebrew formulas have names that do not correspond with any of the installed commands (e.g., coreutils
, speech-tools
), other formulas provide an command that matches up with the name, but also provide others alongside it (e.g., lua
).
Is there a simple way to determine what commands are associated with a given formula? Ideally as a brew <arg>
command before installing, but even a shell script I could use post-install would help.
I thought I might be able to figure this info out with a brew link --dry-run <formula>
, but that typically just gives me a warning that the formula is already linked (even with --overwrite
or --force
added to the command). I don't want to have to unlink each time I want to see the commands, so this route doesn't seem helpful.
Best Answer
As bmike's answer points out, aside from digging through the projects source to determine what executables they install, there's no good way to determine what commands come with a given formula before installing it.
After a formula is installed, running
is a workable option now that
--dry-run
is available forbrew unlink
.Before that was added I wrote an external command called
brew executables
that still has some benefits over the above (mainly in formatting and handling some links a bit differently). I'll include a simplified (and probably non-working, due to missing some variable assignments) version of it here:In short, it pulls the list of executables out of
$(brew --prefix)/$formula/$version_in_use/bin
. The version on my GitHub is a bit more fleshed out, including some added ability to identify/indicate when there are commands that link to each other in this bin directory.