user1978019
user1978019

Reputation: 3336

How do I know where homebrew installs symlinks?

Where does homebrew create symlinks? I know that it appears to be $(brew --prefix)/bin, but where is this documented? Can things be linked elsewhere?

When I run brew install node, I end up with node on my path at /usr/local/bin/node:

$ which node
/usr/local/bin/node

brew unlink and brew link will remove them and add them back for me. According to man brew, brew link will symlink "all of formula's installed files into the Homebrew prefix". However:

$ brew --prefix
/usr/local

It seems like the correct statement would be "into the Homebrew prefix + bin". Can formula sometimes link to places other than $(brew --prefix)/bin? Is the +bin idea formula-dependent? Should it actually say something like "into the Homebrew prefix plus a formula-specific suffix (usually bin)"? I've looked at a few formulae and it doesn't seem to be, although I could be missing it.

I'm trying to gain a more complete understanding of Homebrew, and this has long confused me. I'm not having any problems, I'm just trying to figure out if the documentation is incomplete, if there is a command I'm missing, etc.

Upvotes: 8

Views: 9410

Answers (1)

mipadi
mipadi

Reputation: 410952

Yes, symlinks can be placed elsewhere. For example, a formula might put a symlink at $(brew --prefix)/lib. You can list all of a formula's files by running brew ls $formula (although not all files are necessarily symlinked into a subdirectory of brew --prefix, but most are).

Upvotes: 2

Related Questions