HomebrewでmacOSにiftopをインストールする方法


iftopをbrewでインストールすると以下のようになり,コマンドが失敗してしまったのでその備考録.

❯ brew install iftop                                              
==> Downloading https://homebrew.bintray.com/bottles/iftop-1.0pre4.el_capitan.bottle.tar.gz
Already downloaded: /Users/user_name/Library/Caches/Homebrew/iftop-1.0pre4.el_capitan.bottle.tar.gz
==> Pouring iftop-1.0pre4.el_capitan.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/man8/iftop.8
/usr/local/share/man/man8 is not writable.

You can try again using:
  brew link iftop
==> Caveats
iftop requires root privileges so you will need to run `sudo iftop`.
You should be certain that you trust any software you grant root privileges.
==> Summary
🍺  /usr/local/Cellar/iftop/1.0pre4: 9 files, 99K

調べてみると/usr/local/Cellar/iftop/1.0pre4/sbin/iftopには配置されているようなのでシンボリックリンクを作ってコマンドが通るようにする

$ sudo chown root:wheel /usr/local/Cellar/iftop/1.0pre4/sbin/iftop     

$ sudo chmod u+s /usr/local/Cellar/iftop/1.0pre4/sbin/iftop

$ ln -s /usr/local/Cellar/iftop/1.0pre4/sbin/iftop /usr/local/bin/iftop                                                                   
$ iftop

一応これで通るようになりました.iftopのversionなど,変更している可能性があるのでご留意ください

(2017/02/02 現在のバージョン 1.0pre4)