Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
    
Your formula wasn't linked to /usr/bin. Try brew link dsniff. Does that work or do you get an error? –  slhck Jan 2 '13 at 22:30
    
Threw an error: Warning: Already linked: /usr/local/Cellar/dsniff/2.4b1 To relink: brew unlink dsniff && brew link dsniff –  Abe Miessler Jan 2 '13 at 22:32
    
Does it work if you re-link? Or throw any error messages? Can you run /usr/local/Cellar/dsniff/2.4b1/dsniff directly? (Just literally execute this) –  slhck Jan 2 '13 at 22:36
    
If run your code snippit directly I get the same error. But if I go to the directory and type ./dsniff it runs... –  Abe Miessler Jan 2 '13 at 22:43
add comment

5 Answers

up vote 1 down vote accepted

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
share|improve this answer
add comment

You can try manually linking the executable dsniff.

ln -s /usr/local/Cellar/dsniff/2.4b1/dsniff /usr/local/bin/dsniff

This creates a link back to the original file in Cellar, but your shell will be able to find it in its path, because /usr/local/bin is usually in it.

After doing so, you can call dsniff from anywhere.

share|improve this answer
    
Hrrm, that's still giving me a command not found error –  Abe Miessler Jan 2 '13 at 22:46
    
What does echo $PATH give you? –  slhck Jan 2 '13 at 22:46
    
/Users/abe/.rvm/gems/ruby-1.9.3-p286/bin:/Users/abe/.rvm/gems/ruby-1.9.3-p286@gl‌​obal/bin:/Users/abe/.rvm/rubies/ruby-1.9.3-p286/bin:/Users/abe/.rvm/bin:/usr/bin:‌​/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin –  Abe Miessler Jan 2 '13 at 23:13
    
Have you restarted your shell in between? Can you confirm that dsniff now is in /usr/local/bin? –  slhck Jan 2 '13 at 23:15
    
I haven't restarted my shell. dsniff is in /usr/local/bin –  Abe Miessler Jan 2 '13 at 23:17
show 3 more comments

Check /usr/local/bin and is it in your $PATH? Make sure /usr/local/bin is before /usr/bin.

For a quick (non-permanent) check, execute export PATH=/usr/local/bin:$PATH in the current shell and retry to run the command.

share|improve this answer
    
Ok, I went to /usr/local/bin and dsniff is not there. Could this be my issue? –  Abe Miessler Jan 2 '13 at 16:38
add comment

As kukoo mentioned, it sounds like you don't have /usr/local/bin in your path. To make it so you can easily run applications that you've installed from brew, run this command:

echo "export PATH=/usr/local/bin:\$PATH" >> $HOME/.bashrc

That should set you straight.

As for why it didn't run after being in the same directory, it's probably because of the way you were referencing it. Did you preface the binary name with ./?

share|improve this answer
add comment

If anyone else is having issues and their $PATH variable is already fine, I'd suggest:

brew unlink dsniff
brew link dsniff

This worked for me when I had a similar issue.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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