Brew installed, linked, but not found
I just installed mtr
via Homebrew, and it completed seemingly successfully (i.e., nothing unusual).
MBA% mtr
zsh: command not found: mtr
That's odd. I figured I'd try again:
MBA% brew install mtr
Warning: mtr-0.86 already installed
Okay, maybe it's symlinked as mtr-0.86
:
MBA% mtr-0.86
zsh: command not found: mtr-0.86
Nope, okay, maybe it just failed to link:
MBA% brew link mtr
Warning: Already linked: /usr/local/Cellar/mtr/0.86
To relink: brew unlink mtr && brew link mtr
MBA% brew unlink mtr && brew link mtr
Unlinking /usr/local/Cellar/mtr/0.86... 3 symlinks removed
Linking /usr/local/Cellar/mtr/0.86... 2 symlinks created
MBA% mtr zsh: command not found: mtr
However:
MBA% /usr/local/Cellar/mtr/0.86/sbin/mtr
[Success]
What's going on? Why is Homebrew failing to link (and creating fewer symlinks on relinking for that matter..)?
I saw the same when installing brew 0.86. While most binaries get linked to /usr/local/bin, brew get's linked to /usr/local/sbin. This is absolutely right but you need to extend your path in order to avoid typing the whole path.
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
will fix it once and you will need to adjust your .bash_profile to fix it permanently
For mtr v0.86 and below:
brew install mtr
ln /usr/local/Cellar/mtr/0.86/sbin/mtr /usr/local/bin/mtr
sudo mtr superuser.com
But since mtr v0.87 one more command is needed:
ln /usr/local/Cellar/mtr/0.92/sbin/mtr-packet /usr/local/bin/mtr-packet
Add /usr/local/sbin
to current PATH
variable and make persistent.
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
sudo echo '/usr/local/sbin' >> /etc/paths