macOS用Homebrew安装WPScan遇nokogiri与Bundler错误求助
macOS下Homebrew安装WPScan时nokogiri/Bundler报错的解决方法
解决步骤
1. 清理旧安装与缓存
- 卸载现有WPScan:
brew uninstall wpscan - 清理Homebrew缓存:
brew cleanup - 删除Bundler本地缓存:
rm -rf ~/.bundle/cache
2. 安装nokogiri所需的系统依赖
nokogiri编译依赖libxml2、libxslt等底层库,先确保这些库正确安装:
brew install libxml2 libxslt
手动指定库路径安装对应版本的nokogiri(避免自动编译检测失败):
gem install nokogiri -v 1.15.6 -- --use-system-libraries --with-xml2-include=$(brew --prefix libxml2)/include/libxml2 --with-xslt-include=$(brew --prefix libxslt)/include
3. 重新安装WPScan
- 确保添加WPScan官方tap(未添加过则执行):
brew tap wpscanteam/tap - 强制重新安装并让Bundler重新解析依赖:
brew install wpscanteam/tap/wpscan --force
备选方案:解决Ruby版本冲突
若系统Ruby与Homebrew Ruby版本冲突导致依赖异常,可优先使用Homebrew提供的Ruby:
- 将Homebrew Ruby加入环境变量(bash用户替换
~/.zshrc为~/.bash_profile):echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc - 刷新环境配置:
source ~/.zshrc - 再次执行WPScan安装命令
内容的提问来源于stack exchange,提问作者Christos Konstantakis
相关产品推荐
相关产品推荐

