I have hit upon a stumbling block here trying to get Nokogiri working on osx 10.5.8.
我试图让Nokogiri在osx 10.5.8上工作,遇到了一个绊脚石。
Tried http://nokogiri.org/tutorials/installing_nokogiri.html and then http://martinisoftware.com/2009/07/31/nokogiri-on-leopard.html
尝试http://nokogiri.org/tutorials/installing_nokogiri.html然后http://martinisoftware.com/2009/07/31/nokogiri-on-leopard.html
A colleague has been trying to help too but cannot get rid of this error message:
一位同事一直试图帮助,但无法摆脱这个错误信息:
Library not loaded: /usr/local/lib/libxml2.2.dylib ... Reason: Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0
未加载库:/usr/local/lib/libxml2.2.dylib ...原因:库版本不兼容:nokogiri.bundle需要11.0.0或更高版本,但libxml2.2.dylib提供版本10.0.0
We have tried to compile the gem using the newly installed libraries but still coming up against this error.
我们尝试使用新安装的库编译gem,但仍然遇到此错误。
Any help or pointers really appreciated!
任何帮助或指示真的很感激!
I have been given a copy of osx 10.6 - could this help??
我得到了osx 10.6的副本 - 这有用吗?
Thanks
3 个解决方案
#1
20
Actually, the answer is in: http://nokogiri.org/tutorials/installing_nokogiri.html
实际上,答案是:http://nokogiri.org/tutorials/installing_nokogiri.html
brew install libxml2 libxslt
brew link libxml2 libxslt
Then install libiconv from source:
然后从源代码安装libiconv:
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xvfz libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local/Cellar/libiconv/1.13.1
make
sudo make install
Then (finally) install nokogiri:
然后(最后)安装nokogiri:
gem install nokogiri --
--with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2
--with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib
--with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
--with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include
--with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
Making sure that you have the versions of libxml2 as you have them in /usr/local/Cellar/libxml (in my case it was 2.8.0).
确保你有/ usr / local / Cellar / libxml中的libxml2版本(在我的例子中是2.8.0)。
Happy coding!
#2
8
The following worked for me on OS-X 10.9.1 (Mavericks):
以下在OS-X 10.9.1(Mavericks)上为我工作:
brew install libxml2 libxslt
gem install nokogiri -- --with-xslt-dir=/usr/local/opt/libsxlt
#3
0
I just hopped on my 10.5 machine and remembered getting a working version of Nokogiri there - so looked up the command history and here's a cut'n'paste of my exact commands, using Homebrew:
我刚刚跳上我的10.5机器并记得在那里找到了Nokogiri的工作版本 - 所以查看了命令历史记录,这里是我使用Homebrew的确切命令的切入点:
brew install libxml2 libxslt
brew install libiconv
sudo gem install nokogiri -- --with-xslt-dir=/usr/local/homebrew/Cellar/libxslt/1.1.26
Although I'd still upgrade to 10.6.
虽然我仍然升级到10.6。
Older answer:
This answer might help. After resisting OS X package managers, I gave in to Homebrew which helped me solve similar issues. This is for RVM (where I remember going through a similar process) but the key is to tell the nokogiri gem to use the new libxml2 install.
这个答案可能有帮助。在抵制OS X包管理器之后,我放弃了Homebrew,帮助我解决了类似的问题。这适用于RVM(我记得经历过类似的过程),但关键是要告诉nokogiri gem使用新的libxml2安装。
BTW (slightly off-topic but relevant if you're going to 10.6) OOI you can check your mac for a 64 bit EFI in Terminal:
顺便说一句(稍微偏离主题,但如果你要10.6那么相关)OOI你可以检查你的mac在终端中的64位EFI:
ioreg -l -p IODeviceTree | grep firmware-abi
you should see (if 64 bit):
你应该看到(如果64位):
"firmware-abi" = <"EFI64">
although (as detailed in the replies to that article) this doesn't mean everything's plain sailing...
虽然(详见对该文章的回复)但这并不意味着一切都顺风顺水......
#1
20
Actually, the answer is in: http://nokogiri.org/tutorials/installing_nokogiri.html
实际上,答案是:http://nokogiri.org/tutorials/installing_nokogiri.html
brew install libxml2 libxslt
brew link libxml2 libxslt
Then install libiconv from source:
然后从源代码安装libiconv:
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xvfz libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local/Cellar/libiconv/1.13.1
make
sudo make install
Then (finally) install nokogiri:
然后(最后)安装nokogiri:
gem install nokogiri --
--with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2
--with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib
--with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
--with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include
--with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
Making sure that you have the versions of libxml2 as you have them in /usr/local/Cellar/libxml (in my case it was 2.8.0).
确保你有/ usr / local / Cellar / libxml中的libxml2版本(在我的例子中是2.8.0)。
Happy coding!
#2
8
The following worked for me on OS-X 10.9.1 (Mavericks):
以下在OS-X 10.9.1(Mavericks)上为我工作:
brew install libxml2 libxslt
gem install nokogiri -- --with-xslt-dir=/usr/local/opt/libsxlt
#3
0
I just hopped on my 10.5 machine and remembered getting a working version of Nokogiri there - so looked up the command history and here's a cut'n'paste of my exact commands, using Homebrew:
我刚刚跳上我的10.5机器并记得在那里找到了Nokogiri的工作版本 - 所以查看了命令历史记录,这里是我使用Homebrew的确切命令的切入点:
brew install libxml2 libxslt
brew install libiconv
sudo gem install nokogiri -- --with-xslt-dir=/usr/local/homebrew/Cellar/libxslt/1.1.26
Although I'd still upgrade to 10.6.
虽然我仍然升级到10.6。
Older answer:
This answer might help. After resisting OS X package managers, I gave in to Homebrew which helped me solve similar issues. This is for RVM (where I remember going through a similar process) but the key is to tell the nokogiri gem to use the new libxml2 install.
这个答案可能有帮助。在抵制OS X包管理器之后,我放弃了Homebrew,帮助我解决了类似的问题。这适用于RVM(我记得经历过类似的过程),但关键是要告诉nokogiri gem使用新的libxml2安装。
BTW (slightly off-topic but relevant if you're going to 10.6) OOI you can check your mac for a 64 bit EFI in Terminal:
顺便说一句(稍微偏离主题,但如果你要10.6那么相关)OOI你可以检查你的mac在终端中的64位EFI:
ioreg -l -p IODeviceTree | grep firmware-abi
you should see (if 64 bit):
你应该看到(如果64位):
"firmware-abi" = <"EFI64">
although (as detailed in the replies to that article) this doesn't mean everything's plain sailing...
虽然(详见对该文章的回复)但这并不意味着一切都顺风顺水......