Problem trying to install iftop via Homebrew

homebrewunix

I got Homebrew installed, but:

>brew install iftop
==> Downloading http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
File already downloaded in /Volumes/0/z/Library/Caches/Homebrew
==> ./configure --disable-debug --prefix=/usr/local/Cellar/iftop/0.17 --mandir=/usr/local/Cellar/iftop/0.17/share/man
==> make install
ln: iftop: Permission denied
Error: The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link iftop'
Warning: /usr/local/sbin is not in your PATH
You can amend this by altering your ~/.bashrc file
==> Summary
/usr/local/Cellar/iftop/0.17: 7 files, 116K, built in 3 seconds

FYI, ~/.bashrc does not exist, and

>$PATH
-bash: /Volumes/0/z/android:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin: No such file or directory

What should I do?
Thanks!

Best Answer

You can remedy things in your current shell by doing:

mkdir -p /usr/local/sbin
export PATH=${PATH}:/usr/local/sbin
brew link iftop

That'll get you past the warnings and let Homebrew install the iftop package. If the iftop package is installing things in to /usr/local/sbin that you're looking to run, you'll need to ensure this is on your $PATH when you open a shell. To do this, edit ~/.bash_profile and add the line:

export PATH=${PATH}:/usr/local/sbin

To the end of the file to prepend /usr/local/sbin to each new shell you open.