在 macOS 系统里成功运行 Wireshark
这个标题看上去有点莫名其妙,难道要运行 wireshark,不就是安装,再运行吗?
如果你从没有遇到任何问题,建议直接跳过不要看了。如果你和我一样,也碰到一些障碍,那么本文可以供你参考一下。
问题 1,brew install --cask wireshark 安装不了
不知怎的,我执行安装命令,先是报这样的错误:
brew install --cask wireshark
...
==> Moving App 'Wireshark.app' to '/Applications/Wireshark.app'
==> Backing App 'Wireshark.app' up to '/usr/local/Caskroom/wireshark/3.6.1/Wireshark.app'
==> Removing App '/Applications/Wireshark.app'
jietian is not in the sudoers file. This incident will be reported.
==> Purging files for version 3.6.1 of Cask wireshark
Error: It seems there is already a Binary at '/usr/local/bin/editcap'.
说当前账号不在管理员列表里!原因不明,系升级系统后出现,已解决。参考:
【已解决】开工大吉:折腾当前管理员账号不在 sudoer 列表里的问题
问题 2,文件已存在错误
在解决了问题1之后,重试安装,出现二进制文件已存在的错误:
brew install --cask wireshark
Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 2 formulae.
==> Downloading https://2.na.dl.wireshark.org/osx/Wireshark%203.6.1%20Intel%2064.dmg
Already downloaded: /Users/cnjeftia/Library/Caches/Homebrew/downloads/1823ce9e1fb7b7498efed78d11e32488883ddc068d75da2df32133384d304990--Wireshark 3.6.1 Intel 64.dmg
==> Installing Cask wireshark
==> Running installer for wireshark; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
Password:
installer: Package name is ChmodBPF
installer: Upgrading at base path /
installer: The upgrade was successful.
==> Running installer for wireshark; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
installer: Package name is Add Wireshark to the system PATH
installer: Upgrading at base path /
installer: The upgrade was successful.
==> Moving App 'Wireshark.app' to '/Applications/Wireshark.app'
==> Backing App 'Wireshark.app' up to '/usr/local/Caskroom/wireshark/3.6.1/Wireshark.app'
==> Removing App '/Applications/Wireshark.app'
==> Purging files for version 3.6.1 of Cask wireshark
Error: It seems there is already a Binary at '/usr/local/bin/editcap'.
通过先卸载,再重装解决了:
brew uninstall wireshark
Warning: Treating wireshark as a formula. For the cask, use homebrew/cask/wireshark
Uninstalling /usr/local/Cellar/wireshark/3.6.1... (1,144 files, 98.6MB)
brew install --cask wireshark
Running `brew update --preinstall`...
==> Downloading https://2.na.dl.wireshark.org/osx/Wireshark%203.6.1%20Intel%2064.dmg
Already downloaded: /Users/cnjeftia/Library/Caches/Homebrew/downloads/1823ce9e1fb7b7498efed78d11e32488883ddc068d75da2df32133384d304990--Wireshark 3.6.1 Intel 64.dmg
==> Installing Cask wireshark
==> Running installer for wireshark; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
Password:
installer: Package name is ChmodBPF
installer: Upgrading at base path /
installer: The upgrade was successful.
==> Running installer for wireshark; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
installer: Package name is Add Wireshark to the system PATH
installer: Upgrading at base path /
installer: The upgrade was successful.
==> Moving App 'Wireshark.app' to '/Applications/Wireshark.app'
==> Linking Binary 'editcap' to '/usr/local/bin/editcap'
==> Linking Binary 'androiddump' to '/usr/local/bin/androiddump'
==> Linking Binary 'ciscodump' to '/usr/local/bin/ciscodump'
==> Linking Binary 'randpktdump' to '/usr/local/bin/randpktdump'
==> Linking Binary 'sshdump' to '/usr/local/bin/sshdump'
==> Linking Binary 'idl2wrs' to '/usr/local/bin/idl2wrs'
==> Linking Binary 'mergecap' to '/usr/local/bin/mergecap'
==> Linking Binary 'mmdbresolve' to '/usr/local/bin/mmdbresolve'
==> Linking Binary 'randpkt' to '/usr/local/bin/randpkt'
==> Linking Binary 'rawshark' to '/usr/local/bin/rawshark'
==> Linking Binary 'reordercap' to '/usr/local/bin/reordercap'
==> Linking Binary 'sharkd' to '/usr/local/bin/sharkd'
==> Linking Binary 'text2pcap' to '/usr/local/bin/text2pcap'
==> Linking Binary 'tshark' to '/usr/local/bin/tshark'
==> Linking Binary 'udpdump' to '/usr/local/bin/udpdump'
==> Linking Binary 'capinfos' to '/usr/local/bin/capinfos'
==> Linking Binary 'captype' to '/usr/local/bin/captype'
==> Linking Binary 'dftest' to '/usr/local/bin/dftest'
==> Linking Binary 'dumpcap' to '/usr/local/bin/dumpcap'
🍺 wireshark was successfully installed!
问题 3,尝试运行碰到被系统阻止的错误
如下图所示。尝试运行出现警告框。通过系统的安全和隐私面板,点击“Open Anyway”,仍然不能运行,说是由于开发者不能被识别,所以被阻止运行。
这题我会,没有做任何搜索,直接命令行输入:
sudo spctl --master-disable
然后,再次点击“Open Anyway”,成功打开!
这个 sudo spctl --master-disable
命令,我上一次使用,还是在安装 WeWork 打印机时。
参考:
评论