16

brew link puts symlinks all over the place. How do I find out where, for a particular package?

For example, I have cairo installed via brew. brew list cairo shows me a list of installed files. When I link cairo, brew creates symlinks.

$ brew link cairo                                          
Linking /usr/local/Cellar/cairo/1.14.0... 28 symlinks created

How do I find out where those symlinks are?

0

2 Answers 2

14

symlinks are typically in /usr/local/ and is defined as by brew --prefix. To see where the app symlinks to (using wget as an example),

$ brew link wget --dry-run
Warning: Already linked: /usr/local/Cellar/wget/1.16.1
To relink: brew unlink wget && brew link wget

According to the brew man page:

If  --dry-run or -n is passed, Homebrew will list all files which would be linked or which would be deleted by brew link --overwrite, but will not actually link or delete any files.

To see where all of the files are located, use the list [formula] --verbose option like so

$ brew list wget --verbose
/usr/local/Cellar/wget/1.16.1/AUTHORS
/usr/local/Cellar/wget/1.16.1/bin/wget
/usr/local/Cellar/wget/1.16.1/ChangeLog
/usr/local/Cellar/wget/1.16.1/COPYING
/usr/local/Cellar/wget/1.16.1/INSTALL_RECEIPT.json
/usr/local/Cellar/wget/1.16.1/NEWS
/usr/local/Cellar/wget/1.16.1/README
/usr/local/Cellar/wget/1.16.1/share/info/wget.info
/usr/local/Cellar/wget/1.16.1/share/man/man1/wget.1
2
  • 3
    Worth noting that you have to unlink before linking with --dry-run, or brew will complain with "already linked."
    – Brandon
    Feb 9, 2015 at 19:36
  • If, like me, you hit this (apparent bug), you have to unlink; unlink also supports --dry-run, so it's then just a matter of whether you need to run link or unlink w/ that flag. (I wish link --dry-run would just list, or brew list would just list…)
    – Thanatos
    Aug 7, 2023 at 20:36
3

In the case the package is already linked you can list existing links:

brew unlink <formulae> --dry-run

To get more info about the links:

brew unlink <formulae> --dry-run | xargs ls -l

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .