使用Homebrew卸载/重装Wireshark Cask失败的原因及求助
解决Homebrew重装Wireshark Cask时Uninstall ChmodBPF.pkg失败的问题
问题场景
运行MacOS 12.6.3 Monterrey的Mac电脑,执行brew reinstall --cask wireshark时,卸载环节出现以下错误:
Error: Failure while executing; `/usr/bin/sudo -E -- /usr/sbin/installer -pkg /opt/homebrew/Caskroom/wireshark/4.0.7/Uninstall\ ChmodBPF.pkg -target /` exited with 1. Here's the output: installer: Package name is Uninstall ChmodBPF installer: Installing at base path / installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “Uninstall ChmodBPF.pkg”.)
已尝试更新brew、升级brew、更新Xcode,均无法解决。
解决方案
1. 手动清理ChmodBPF相关残留文件
执行以下命令删除ChmodBPF的核心组件:
- 删除LaunchDaemon配置文件:
sudo rm /Library/LaunchDaemons/org.wireshark.ChmodBPF.plist - 删除ChmodBPF执行脚本目录:
sudo rm -r /Library/Application\ Support/Wireshark/ChmodBPF - 删除wireshark用户组(如果存在):
sudo dscl . -delete /Groups/wireshark
2. 强制卸载Wireshark Cask
忽略卸载错误,强制清理Homebrew中的Wireshark记录:
brew uninstall --cask --force wireshark
3. 清理Homebrew缓存
brew cleanup
4. 重新安装Wireshark
brew install --cask wireshark
备选方案:手动安装
如果上述步骤仍失败,可直接使用已下载的安装包手动安装:
- 打开终端,进入缓存目录(替换
[username]为你的用户名):cd /Users/[username]/Library/Caches/Homebrew/downloads/ - 找到对应的Wireshark dmg文件(名称类似
63f9d1988808d4cba46a2f29ffb65b066414802b6368cea4122317942d55d4c8--Wireshark 4.0.7 Arm 64.dmg),双击打开挂载镜像。 - 运行镜像中的
Wireshark.mpkg完成安装,之后手动安装ChmodBPF.pkg以获取抓包权限。
内容的提问来源于stack exchange,提问作者PraderaNoire
相关产品推荐
相关产品推荐

