Brew installed, linked, but not found
Solution 1
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
Solution 2
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
Solution 3
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
Related videos on Youtube
OJFord
Updated on September 18, 2022Comments
-
OJFord over 1 year
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..)?
-
OJFord almost 9 years(Keen-eyed may note that
mtr
needs root. Yes. By [Success] I mean it complained about just that, rather than failing to even run.)
-
-
Tuanitim about 7 yearsActually mtr was already in /usr/local/sbin. The solution of adding /usr/local/sbin to the PATH is better.
-
styfle over 3 yearsSince macOS no longer uses bash as the default shell, it would be better to edit
/etc/paths
instead of.bash_profile
. See stackoverflow.com/a/16288733/266535