Published on

TIL: Homebrew updated tailscale, but PATH ran an older copy

TIL: Homebrew updated tailscale, but PATH ran an older copy
Authors

I updated a CLI through Homebrew and the version didn't change.

Homebrew had already told me why. It was right there in the output:

The following tailscale executables are shadowed by other commands earlier in your PATH:
 tailscale (shadowed by /usr/local/bin/tailscale)
Running these by name will not invoke the version provided by Homebrew.

which -a lists every match in PATH order, not just the first one:

which -a tailscale
# /Users/me/.local/bin/tailscale
# /opt/homebrew/bin/tailscale
# /usr/local/bin/tailscale

Three copies. Typing the name runs the first one, and that isn't the one Homebrew just updated.

There's a second twist: the warning and my shell disagree on order. In my shell, /usr/local/bin comes after /opt/homebrew/bin, so the PATH brew checked wasn't the PATH of the shell I was typing in. The list that decides what actually runs is which -a in your own shell.

How to sort it out

  • Check which one you're really running with type -a name, or run the full path with --version.
  • Delete the stale copies, or move the folder you want to the front of PATH.

And read the caveats block at the end of an install. It said all of this plainly, and I'd scrolled right past it.