Installed application using brew, but now it’s saying it can’t find it

homebrew

I have installed an application (dsniff) using brew, but when I try to run it I get a "Command not found" error. I even tried going to the directory it was installed to:

/usr/local/Cellar/dsniff/2.4b1/sbin/

confirming that it was there (it is) and running it, but I get the same error. Any idea why this would happen?

Best Answer

Dsniff links its programs in to /usr/local/sbin instead of /usr/local/bin. The sbin/ directory is for more sysadmin-oriented stuff and isn't on the path for non-root accounts. Most other Homebrew formulae don't link there.

Dsniff will even warn you about this during the installation.

$ brew install dsniff
==> Downloading http://monkey.org/~dugsong/dsniff/beta/dsniff-2.4b1.tar.gz
#
[ ... ]
==> make install
Warning: /usr/local/sbin is not in your PATH
You can amend this by altering your ~/.bashrc file
==> Summary
/usr/local/Cellar/dsniff/2.4b1: 35 files, 420K, built in 11 seconds

So, add /usr/local/sbin to your path in the same place that you add /usr/local/bin, probably in ~/.bashrc, and you'll pick up dsniff.

In general, when you run in to things like this, and you're not sure where the files went, you can use find to search for them. For Homebrew, they'll always be somewhere under /usr/local, if they're anywhere.

$ find /usr/local -name dsniff
/usr/local/Cellar/dsniff
/usr/local/Cellar/dsniff/2.4b1/sbin/dsniff
/usr/local/Library/LinkedKegs/dsniff
/usr/local/opt/dsniff
/usr/local/sbin/dsniff