HomebrewからWireshark(Tshark)をインストール。
$ brew install wireshark
バージョン確認。
$ tshark --version
TShark (Wireshark) 4.0.6 (Git commit ac2f5a01286a).
〜省略〜
接続確認。
$ tshark -D
1. en0 (Wi-Fi)
〜省略〜
接続時にエラーが出るので、
$ tshark -i en0
Capturing on 'Wi-Fi: en0'
tshark: You do not have permission to capture on device "en0".
((cannot open BPF device) /dev/bpf0: Permission denied)
Please check to make sure you have sufficient permissions.
If you installed Wireshark using the package from wireshark.org, close this dialog and click on the "installing ChmodBPF" link in "You can fix this by installing ChmodBPF." on the main screen, and then complete the installation procedure.
tshark:
0 packets captured
ChmodBPFをインストールしてみる。
※ChmodBPFを再インストールする場合、アンインストールが途中で失敗し、
Homebrewで再インストールも出来なくなる。
そうなった場合、ChmodBPFを下記サイトから一度手動でインストールし直す。
https://www.wireshark.org/download/
$ brew install wireshark-chmodbpf
動くようになる。
$ tshark -i en0
Capturing on 'Wi-Fi: en0'
** (tshark:25063) 10:20:10.802578 [Main MESSAGE] -- Capture started.
** (tshark:25063) 10:20:10.803569 [Main MESSAGE] -- File: "/var/folders/s3/r4ql7qd12b38x0jbvlnh92n40000gn/T/wireshark_Wi-FiBESO71.pcapng"
〜省略〜
ちなみにGUI版をHomebrewで入れようとすると下記で怒られるので、
下記サイトからインストーラーを入手し、手動で入れる必要がある。
https://www.wireshark.org/download/
$ brew install --cask wireshark
Error: Cask 'wireshark' conflicts with 'wireshark-chmodbpf'.