我最近尝试用 Ruby 和 Capybara 编写一个小的抓取脚本;但是,当我编译需要 Capybara 的代码时,出现以下错误:
/Library/Ruby/Gems/1.8/gems/nokogiri-1.5.5/lib/nokogiri/nokogiri.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/nokogiri-1.5.5/lib/nokogiri/nokogiri.bundle, 9): Library not loaded: /opt/local/lib/libiconv.2.dylib (LoadError)
Referenced from: /Library/Ruby/Gems/1.8/gems/nokogiri-1.5.5/lib/nokogiri/nokogiri.bundle
Reason: Incompatible library version: nokogiri.bundle requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0 - /Library/Ruby/Gems/1.8/gems/nokogiri-1.5.5/lib/nokogiri/nokogiri.bundle
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
from /Library/Ruby/Gems/1.8/gems/nokogiri-1.5.5/lib/nokogiri.rb:27
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
from /Library/Ruby/Gems/1.8/gems/capybara-1.1.2/lib/capybara.rb:2
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:60:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:60:in `require'
我已经多次卸载并重新安装了 nokogiri。我已经检查以确保我的 Mac 上唯一安装的 Ruby 是//usr/bin
. 我最近按照 Homebrew 的要求更新了 Xcode 并卸载了 MacPorts。我做错了什么,如果有的话,解决方法是什么?