6

I'm kinda just starting with OS X and Homebrew, yet I find it very useful. However I have one problem: is there a way to make Homebrew automatically create a symlink to the directory of the latest version of a formula? For example, after installing gradle we have

/usr/local/Cellar/gradle/1.6

and it would be very handy (for external configurations) to have also something like

/usr/local/Cellar/gradle/current

(helps with avoiding reconfiguration after formula was updated).

0

2 Answers 2

16

Current Homebrew (4.x) on Apple Silicon machines stores symlinks to the latest versions in /opt/homebrew/opt/:

➜ ls -l /opt/homebrew/opt/ | head -n5
total 0
lrwxr-xr-x  1 werner  admin  22 Nov  8  2021 0mq -> ../Cellar/zeromq/4.3.4
lrwxr-xr-x  1 werner  admin  19 Oct 24 14:53 ack -> ../Cellar/ack/3.6.0
lrwxr-xr-x  1 werner  admin  31 Oct 24 14:37 adwaita-icon-theme -> ../Cellar/adwaita-icon-theme/43
lrwxr-xr-x  1 werner  admin  21 Nov  8  2021 aften -> ../Cellar/aften/0.0.8

This used to be in /usr/local/var/homebrew/linked/ for older Homebrew versions.

Homebrew on x64 machines, using Rosetta 2, writes to /usr/local/opt instead.

3
  • thanks for the quick update! I'll delete my comment (and this one, in a bit)
    – yshavit
    Apr 3, 2023 at 22:29
  • I'm on brew 4.0.17 on macOS (x86), and for me these links are in /usr/local/opt. May 9, 2023 at 9:01
  • @JohanWalles You are running an x86 installation. Homebrew used to place those files in /usr/local but does no longer do this for Apple Silicon, instead writing to its own directory in /opt.
    – slhck
    May 10, 2023 at 7:59
2

The current accepted answer is outdated. For me:

$ brew --version
Homebrew 1.1.9

The current formula directories are symlinked in:

/usr/local/var/homebrew/linked/

1
  • 1
    I fixed my answer. You could have also left me a comment – or even proposed your edit – and I would have updated it. This way I didn't even notice it was wrong or outdated.
    – slhck
    Feb 27, 2017 at 19:25

You must log in to answer this question.

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