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..)?

  • 1
    (Keen-eyed may note that mtr needs root. Yes. By [Success] I mean it complained about just that, rather than failing to even run.) – OJFord Jun 8 '15 at 13:22

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

  • it helps one time – antiqe Mar 25 '16 at 14:21

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
  • Good one, thanks – Venu Murthy Mar 11 '16 at 10:23
  • Actually mtr was already in /usr/local/sbin. The solution of adding /usr/local/sbin to the PATH is better. – Tuanitim Mar 8 '17 at 10:15

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.