我正在设置一台通过 rbenv 运行 Mac OS 10.8 和 Ruby 1.9.3 的新机器。
经过多次试探性的开始,并阅读了许多 Stack Overflow 的答案,我能够使用以下方法安装 Nokogiri:
sudo gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
Building native extensions. This could take a while...
Successfully installed nokogiri-1.5.6
1 gem installed
现在我正在尝试捆绑一个 Rails 应用程序,但我无法安装 Nokogiri。我总是收到缺少 libxml2 的错误。
我尝试的最后一个命令是:
bundle config build.nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
bundle install
有谁知道如何解决这个问题?