Tcpreplayのインストールにつまづいた

Tcpreplaymacにインストールするのに、つまづいたのでメモ。

ふつーにbrewでインストールするも、Library not loadedとか言われる。
tcprewriteはTcpreplayに入ってるツールの1つ。

$ brew install tcprelay
$ tcprewrite
dyld: Library not loaded: /usr/local/lib/libdnet.1.dylib
  Referenced from: /usr/local/bin/tcprewrite
  Reason: image not found

ググってもよく分からないので 再 install してみる。

$ brew uninstall tcpreplay
Uninstalling /usr/local/Cellar/tcpreplay/4.1.0...

$ brew install tcpreplay
Error: You must `brew link libdnet' before tcpreplay can be installed

link 出来てなかったらしい。

$ brew link libdnet
Linking /usr/local/Cellar/libdnet/1.12... 
Error: Could not symlink bin/dnet-config
Target /usr/local/bin/dnet-config
already exists. You may want to remove it:
  rm '/usr/local/bin/dnet-config'

To force the link and overwrite all conflicting files:
  brew link --overwrite libdnet

To list all files that would be deleted:
  brew link --overwrite --dry-run libdnet

$ brew link --overwrite libdnet
Linking /usr/local/Cellar/libdnet/1.12... 
Error: Could not symlink sbin/dnet
/usr/local/sbin is not writable.

なんか所有者別の人になってたっぽい。

$ sudo chown -R $(whoami) /usr/local
$ brew link --overwrite libdnet
$ brew install tcpreplay

これでインストールできた。