I recently upgrade to the 10.10 Yosemite beta, but I'm having trouble getting Nokogiri installed. I'm using RVM and Ruby 1.9.3. I've also followed the steps here and tried following the instructions on Nokogiri's homepage.
我最近升级到10.10 Yosemite测试版,但我很难安装Nokogiri。我使用的是RVM和Ruby 1.9.3。我也遵循了这里的步骤,并按照Nokogiri的主页上的说明进行了尝试。
I've installed libxml2 (2.9.1) and libxslt (1.1.28) via homebrew, and have tried using the command line tools from both my Xcode 5 install and Xcode 6 beta.
我已经通过homebrew安装了libxml2(2.9.1)和libxslt(1.1.28),并尝试使用来自Xcode 5安装和Xcode 6 beta的命令行工具。
gem install nokogiri -v '1.5.5'
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/bin/ruby extconf.rb
checking for libxml/parser.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/bin/ruby
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-libxslt-config
--without-libxslt-config
--with-pkg-config
--without-pkg-config
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-libiconv-config
--without-libiconv-config
/Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
from extconf.rb:114:in `<main>'
Anyone have an idea on how to fix these install errors?
有人知道如何修复这些安装错误吗?
EDIT 6/10/14: After trying for a couple days to get Nokogiri installed on OSX 10.10, I ended up abandoning the task and restored 10.9 on my machine. Several libraries and bundles need to be updated in order to work in the 10.10 environment.
编辑6/10/14:在osx10.10上安装Nokogiri几天后,我放弃了任务,在我的机器上恢复了10.9。为了在10.10环境中工作,需要更新几个库和包。
23 个解决方案
#1
79
I managed to install Nokogiri under Yosemite (OS X 10.10 Preview).
我在约塞米蒂(OS X 10.10预览版)下安装了Nokogiri。
Step 1: Install Brew
Skip this if brew was installed.
如果已经安装了brew,请跳过这个。
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Step 2: Install brew libs
brew tap homebrew/dupes
brew install libxml2 libxslt
brew install libiconv
Step 3: Download and install Apple Commandline Tools for 10.10
It's important that you need to restart after installation.
在安装之后重新启动是很重要的。
Link: command_line_tools_for_osx_10_10_june_2014.dmg
链接:command_line_tools_for_osx_10_10_june_2014.dmg
After restarted, you can check installation in Terminal:
重新启动后,您可以在终端检查安装:
> xcode-select --install
-> xcode-select: error: command line tools are already installed, use "Software Update" to install updates
This error means you have commandline tool installed correctly.
这个错误意味着您已经正确安装了commandline工具。
Installing Nokogiri
Try using n previous version 1.6.1 in your Gemfile, version 1.6.2.1 has issues currently with "10.10 Preview". It only works with my rbenv Ruby 2.0.0p247, failed to install on 2.1.1. You can give your existing Ruby versions a couple of tries.
在您的Gemfile中尝试使用n之前的1.6.1版本,版本1.6.2.1目前有“10.10预览”的问题。它只适用于我的rbenv Ruby 2.0.0p247,未能安装在2.1.1上。您可以尝试使用现有的Ruby版本。
gem install nokogiri -v '1.6.1' -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/
#2
63
libxml2 - 1.6.6.2 in Yosemite:
libxml2 - 1.6.6.2在约塞米蒂:
sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri -- --use-system-libraries -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.2/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.2/lib --with-xslt-lib=/usr/local/lib --with-xslt-include=/usr/local/include
#3
22
For Mac OS El Capitan:
对于Mac OS El Capitan:
gem install nokogiri -v '1.6.7.1' -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2
gem安装nokogiri -v '1.6.7.1 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -。
#4
18
This worked for me:
这工作对我来说:
ARCHFLAGS="-arch x86_64" gem install nokogiri -v '1.6.0'
#5
7
I had the same problem with MacPorts ruby2.1:
我对MacPorts ruby2.1有同样的问题:
can not gem install nokogiri on osx10.10 with macports ruby2.1
The install starts, the cpu goes to 50% on a single core at 100%, then CPU drops to near zero, but iostat tps
goes through the wall.
安装开始时,cpu在单个核心上达到50%,然后cpu下降到接近零,但是iostat tps通过了墙。
This helped:
这帮助:
# port install libiconv libxslt libxml2
# gem install nokogiri -- --use-system-libraries --with-iconv-dir=/opt/local --with-xml2-dir=/opt/local --with-xslt-dir=/opt/local
#6
5
This finally worked for me:
这最终为我起了作用:
sudo gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
#7
5
For anyone else that hasn't been able to get this to work on El Capitan, what finally worked for me was:
对于那些还没能在El Capitan上工作的人来说,最后的工作是:
sudo gem install nokogiri -- --use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-include=/usr/local/opt/libxml2/include/libxml2 --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config
I don't have macports installed, and my system is a weird hodge-podge. Forcing specific installations for each dependency is the only way that I can get Nokogiri to compile. Super annoying, but at least it works.
我没有安装macports,我的系统是一个奇怪的大杂烩。强制每个依赖项的特定安装是我能让Nokogiri编译的唯一方法。超级烦人,但至少它起作用了。
#8
3
The instructions from the Nokogiri website worked for me on both OSX 10.9 and 10.10.
Nokogiri网站上的说明在OSX 10.9和10.10中都为我工作。
brew unlink gcc-4.2 # you might not need this step
gem uninstall nokogiri
xcode-select --install
gem install nokogiri
#9
3
sudo gem update --system
sudo gem install nokogiri -v '1.6.6.2' -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib
#10
2
(full answer here https://gist.github.com/chrisb/4d6a09c6cc1ca2e1b14e)
(完整的答案https://gist.github.com/chrisb/4d6a09c6cc1ca2e1b14e)
It looks like Homebrew somehow depends on Ruby being in Versions/1.8 (though even Mavericks ships with 2.0). Until Homebrew addresses this, we'll symlink our system version of Ruby to the one Homebrew looks for.
看起来Homebrew在某种程度上依赖于Ruby的版本/1.8(即使是2.0版的Mavericks)。在Homebrew解决这个问题之前,我们将把我们的系统版本的Ruby与一个自制的版本联系起来。
Create the folder:
创建的文件夹:
sudo mkdir -p /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin
Then symlink the binary:
然后二进制符号链接:
sudo ln -s /usr/bin/ruby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
#11
2
This worked for me:
这工作对我来说:
$ brew install libxml2 libxslt # optional?
$ brew install libiconv # optional?
$ gem install nokogiri -v 1.6.8 -- --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2
on environment like this:
在这样的环境:
$ sw_vers -productVersion
10.9.4
$ brew -v
Homebrew 0.9.9 (git revision aa747; last commit 2016-05-26)
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14
- RUBY VERSION: 2.0.0 (2014-02-24 patchlevel 451) [universal.x86_64-darwin13]
#12
1
The only thing that worked for me was to upgrade the compiler from apple-gcc42 to gcc48:
我唯一能做的就是把编译器从苹果gcc42升级到gcc48:
brew uninstall apple-gcc42
brew install gcc48 # this might take an hour or so
rvm implode
\curl -sSL https://get.rvm.io | bash -s stable # reinstall RVM
rvm install ruby-1.9.3-p551
bundle update libv8 # 3.16.14.3 doesn't work but 3.16.14.7 does
bundle
#13
1
If you're using OS X 10.10 and MacPorts you have to install pkgconfig as well:
如果您使用的是OS X 10.10和MacPorts,您必须安装pkgconfig:
sudo port install pkgconfig libxml2 libxslt libiconv
Also if you want to use MacPorts libraries automagically without adding configure options you'll need to add this to your .profile or .bashrc:
另外,如果您希望在不添加配置选项的情况下自动使用MacPorts库,则需要将其添加到.profile或.bashrc中:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH
export LDFLAGS="-L/opt/local/lib"
export CPPFLAGS="-I/opt/local/include"
And also you may want to add this to tell Nokogiri to always use your system libraries:
另外,你也可以添加这个功能,告诉Nokogiri总是使用你的系统库:
export NOKOGIRI_USE_SYSTEM_LIBRARIES=Y
Restart terminal after adding all these exports.
在添加所有这些导出之后重新启动终端。
Using this configuration you can install Nokogiri using:
使用此配置,您可以使用以下方式安装Nokogiri:
gem install nokogiri
#14
1
I got the same error message on OS X Yosemite version 10.10.5
我在OS X Yosemite版本10.10.5上得到了相同的错误消息。
I had recently done various OS updates and it turned out I only needed to accept the new xcode license agreement using the following command:
我最近做了各种OS更新,结果我只需要使用以下命令接受新的xcode许可协议:
sudo xcodebuild -license
#15
0
Maybe my post on github can help you out. My environment was giving me headaches
也许我在github上的帖子能帮你。我的环境让我头疼。
#16
0
In my case, the error message was written below and the accordingly solution as well.
在我的例子中,错误消息写在下面,相应的解决方案也写在下面。
Error message:
错误信息:
...
libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
...
Solution:
解决方案:
gem install nokogiri -- --use-system-libraries --with-libxml2lib=/usr/local/opt/libxml2/lib/libxml2.a
I directly gave it the path of the library of libxml2.a
我直接给出了libxml2.a库的路径。
#17
0
Install the full Xcode. It was the only thing that worked for me for old Nokogiri versions.
安装完整的Xcode。这是我唯一为老诺科吉里的版本工作的东西。
#18
0
For me switching to Xcode 5 rather than using Xcode 6's CLI tool:
对于我来说,切换到Xcode 5而不是使用Xcode 6的CLI工具:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
#19
0
I think the issue is related to the system Ruby not being found or multiple Rubies are installed.
我认为这个问题与系统Ruby没有找到或多个红宝石被安装有关。
- Do you use RVM to manage rubies?
- 你使用RVM管理红宝石吗?
- What is the output of
ruby -v
? - ruby -v的输出是什么?
Those should be the starting point to finding a solution.
这应该是找到解决方案的起点。
The bad interpreter
error is related to a problem with the Ruby installation.
错误的解释器错误与Ruby安装的问题有关。
Ideally, you should start with the system Ruby, the one that ships with Xcode. So, you would uninstall Xcode completely using:
理想情况下,您应该从系统Ruby开始,这是一个使用Xcode的系统。因此,您将完全使用以下方法卸载Xcode:
http://osxdaily.com/2012/02/20/uninstall-xcode/
http://osxdaily.com/2012/02/20/uninstall-xcode/
Uninstall brew
, rvm
and reinstall them.
Uninstall brew, rvm,重新安装。
#20
0
Just try:
试试:
xcode-select --install
#21
0
solve the "Can't write /usr/bin/nokogiri while Installing on Mac OS EI Capitan" problem on mac os x:
在Mac OS x上,解决“不能写/usr/bin/nokogiri在Mac OS EI Capitan上安装”的问题:
sudo gem install nokogiri -n /usr/local/bin
参考:https://www.bountysource.com/issues/28085261-can-t-write-usr-bin-nokogiri-while-installing-on-mac-os-ei-capitan
#22
0
This worked:
这工作:
gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2 --use-system-libraries
gem安装nokogiri -- -- -- -xml2-include=/Applications/Xcode.app/内容/开发/平台/MacOSX.platform/Developer/SDKs/MacOSX10.11。sdk / usr / include / libxml2——use-system-libraries
源
#23
-1
Try this out:
试试这个:
Install these packages in the given order:
按照给定的顺序安装这些包:
brew install libxml2 libxslt
brew link libxml2 libxslt
gem install nokogiri
Try updating gcc version:
试着更新的gcc版本:
- Update GCC on OSX
- 更新GCC OSX上
- https://superuser.com/questions/517218/how-do-i-install-gcc-4-7-2-on-os-x-10-8
- https://superuser.com/questions/517218/how-do-i-install-gcc-4-7-2-on-os-x-10-8
- Installing libv8 gem on OS X 10.9+
- 在OS X 10.9+上安装libv8 gem。
- libv8 (3.11.8.17) bundle install error on Mac
- libv8(3.11.8.17)包安装错误在Mac上。
#1
79
I managed to install Nokogiri under Yosemite (OS X 10.10 Preview).
我在约塞米蒂(OS X 10.10预览版)下安装了Nokogiri。
Step 1: Install Brew
Skip this if brew was installed.
如果已经安装了brew,请跳过这个。
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Step 2: Install brew libs
brew tap homebrew/dupes
brew install libxml2 libxslt
brew install libiconv
Step 3: Download and install Apple Commandline Tools for 10.10
It's important that you need to restart after installation.
在安装之后重新启动是很重要的。
Link: command_line_tools_for_osx_10_10_june_2014.dmg
链接:command_line_tools_for_osx_10_10_june_2014.dmg
After restarted, you can check installation in Terminal:
重新启动后,您可以在终端检查安装:
> xcode-select --install
-> xcode-select: error: command line tools are already installed, use "Software Update" to install updates
This error means you have commandline tool installed correctly.
这个错误意味着您已经正确安装了commandline工具。
Installing Nokogiri
Try using n previous version 1.6.1 in your Gemfile, version 1.6.2.1 has issues currently with "10.10 Preview". It only works with my rbenv Ruby 2.0.0p247, failed to install on 2.1.1. You can give your existing Ruby versions a couple of tries.
在您的Gemfile中尝试使用n之前的1.6.1版本,版本1.6.2.1目前有“10.10预览”的问题。它只适用于我的rbenv Ruby 2.0.0p247,未能安装在2.1.1上。您可以尝试使用现有的Ruby版本。
gem install nokogiri -v '1.6.1' -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/
#2
63
libxml2 - 1.6.6.2 in Yosemite:
libxml2 - 1.6.6.2在约塞米蒂:
sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri -- --use-system-libraries -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.2/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.2/lib --with-xslt-lib=/usr/local/lib --with-xslt-include=/usr/local/include
#3
22
For Mac OS El Capitan:
对于Mac OS El Capitan:
gem install nokogiri -v '1.6.7.1' -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2
gem安装nokogiri -v '1.6.7.1 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -。
#4
18
This worked for me:
这工作对我来说:
ARCHFLAGS="-arch x86_64" gem install nokogiri -v '1.6.0'
#5
7
I had the same problem with MacPorts ruby2.1:
我对MacPorts ruby2.1有同样的问题:
can not gem install nokogiri on osx10.10 with macports ruby2.1
The install starts, the cpu goes to 50% on a single core at 100%, then CPU drops to near zero, but iostat tps
goes through the wall.
安装开始时,cpu在单个核心上达到50%,然后cpu下降到接近零,但是iostat tps通过了墙。
This helped:
这帮助:
# port install libiconv libxslt libxml2
# gem install nokogiri -- --use-system-libraries --with-iconv-dir=/opt/local --with-xml2-dir=/opt/local --with-xslt-dir=/opt/local
#6
5
This finally worked for me:
这最终为我起了作用:
sudo gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
#7
5
For anyone else that hasn't been able to get this to work on El Capitan, what finally worked for me was:
对于那些还没能在El Capitan上工作的人来说,最后的工作是:
sudo gem install nokogiri -- --use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-include=/usr/local/opt/libxml2/include/libxml2 --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config
I don't have macports installed, and my system is a weird hodge-podge. Forcing specific installations for each dependency is the only way that I can get Nokogiri to compile. Super annoying, but at least it works.
我没有安装macports,我的系统是一个奇怪的大杂烩。强制每个依赖项的特定安装是我能让Nokogiri编译的唯一方法。超级烦人,但至少它起作用了。
#8
3
The instructions from the Nokogiri website worked for me on both OSX 10.9 and 10.10.
Nokogiri网站上的说明在OSX 10.9和10.10中都为我工作。
brew unlink gcc-4.2 # you might not need this step
gem uninstall nokogiri
xcode-select --install
gem install nokogiri
#9
3
sudo gem update --system
sudo gem install nokogiri -v '1.6.6.2' -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib
#10
2
(full answer here https://gist.github.com/chrisb/4d6a09c6cc1ca2e1b14e)
(完整的答案https://gist.github.com/chrisb/4d6a09c6cc1ca2e1b14e)
It looks like Homebrew somehow depends on Ruby being in Versions/1.8 (though even Mavericks ships with 2.0). Until Homebrew addresses this, we'll symlink our system version of Ruby to the one Homebrew looks for.
看起来Homebrew在某种程度上依赖于Ruby的版本/1.8(即使是2.0版的Mavericks)。在Homebrew解决这个问题之前,我们将把我们的系统版本的Ruby与一个自制的版本联系起来。
Create the folder:
创建的文件夹:
sudo mkdir -p /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin
Then symlink the binary:
然后二进制符号链接:
sudo ln -s /usr/bin/ruby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
#11
2
This worked for me:
这工作对我来说:
$ brew install libxml2 libxslt # optional?
$ brew install libiconv # optional?
$ gem install nokogiri -v 1.6.8 -- --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2
on environment like this:
在这样的环境:
$ sw_vers -productVersion
10.9.4
$ brew -v
Homebrew 0.9.9 (git revision aa747; last commit 2016-05-26)
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14
- RUBY VERSION: 2.0.0 (2014-02-24 patchlevel 451) [universal.x86_64-darwin13]
#12
1
The only thing that worked for me was to upgrade the compiler from apple-gcc42 to gcc48:
我唯一能做的就是把编译器从苹果gcc42升级到gcc48:
brew uninstall apple-gcc42
brew install gcc48 # this might take an hour or so
rvm implode
\curl -sSL https://get.rvm.io | bash -s stable # reinstall RVM
rvm install ruby-1.9.3-p551
bundle update libv8 # 3.16.14.3 doesn't work but 3.16.14.7 does
bundle
#13
1
If you're using OS X 10.10 and MacPorts you have to install pkgconfig as well:
如果您使用的是OS X 10.10和MacPorts,您必须安装pkgconfig:
sudo port install pkgconfig libxml2 libxslt libiconv
Also if you want to use MacPorts libraries automagically without adding configure options you'll need to add this to your .profile or .bashrc:
另外,如果您希望在不添加配置选项的情况下自动使用MacPorts库,则需要将其添加到.profile或.bashrc中:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH
export LDFLAGS="-L/opt/local/lib"
export CPPFLAGS="-I/opt/local/include"
And also you may want to add this to tell Nokogiri to always use your system libraries:
另外,你也可以添加这个功能,告诉Nokogiri总是使用你的系统库:
export NOKOGIRI_USE_SYSTEM_LIBRARIES=Y
Restart terminal after adding all these exports.
在添加所有这些导出之后重新启动终端。
Using this configuration you can install Nokogiri using:
使用此配置,您可以使用以下方式安装Nokogiri:
gem install nokogiri
#14
1
I got the same error message on OS X Yosemite version 10.10.5
我在OS X Yosemite版本10.10.5上得到了相同的错误消息。
I had recently done various OS updates and it turned out I only needed to accept the new xcode license agreement using the following command:
我最近做了各种OS更新,结果我只需要使用以下命令接受新的xcode许可协议:
sudo xcodebuild -license
#15
0
Maybe my post on github can help you out. My environment was giving me headaches
也许我在github上的帖子能帮你。我的环境让我头疼。
#16
0
In my case, the error message was written below and the accordingly solution as well.
在我的例子中,错误消息写在下面,相应的解决方案也写在下面。
Error message:
错误信息:
...
libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
...
Solution:
解决方案:
gem install nokogiri -- --use-system-libraries --with-libxml2lib=/usr/local/opt/libxml2/lib/libxml2.a
I directly gave it the path of the library of libxml2.a
我直接给出了libxml2.a库的路径。
#17
0
Install the full Xcode. It was the only thing that worked for me for old Nokogiri versions.
安装完整的Xcode。这是我唯一为老诺科吉里的版本工作的东西。
#18
0
For me switching to Xcode 5 rather than using Xcode 6's CLI tool:
对于我来说,切换到Xcode 5而不是使用Xcode 6的CLI工具:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
#19
0
I think the issue is related to the system Ruby not being found or multiple Rubies are installed.
我认为这个问题与系统Ruby没有找到或多个红宝石被安装有关。
- Do you use RVM to manage rubies?
- 你使用RVM管理红宝石吗?
- What is the output of
ruby -v
? - ruby -v的输出是什么?
Those should be the starting point to finding a solution.
这应该是找到解决方案的起点。
The bad interpreter
error is related to a problem with the Ruby installation.
错误的解释器错误与Ruby安装的问题有关。
Ideally, you should start with the system Ruby, the one that ships with Xcode. So, you would uninstall Xcode completely using:
理想情况下,您应该从系统Ruby开始,这是一个使用Xcode的系统。因此,您将完全使用以下方法卸载Xcode:
http://osxdaily.com/2012/02/20/uninstall-xcode/
http://osxdaily.com/2012/02/20/uninstall-xcode/
Uninstall brew
, rvm
and reinstall them.
Uninstall brew, rvm,重新安装。
#20
0
Just try:
试试:
xcode-select --install
#21
0
solve the "Can't write /usr/bin/nokogiri while Installing on Mac OS EI Capitan" problem on mac os x:
在Mac OS x上,解决“不能写/usr/bin/nokogiri在Mac OS EI Capitan上安装”的问题:
sudo gem install nokogiri -n /usr/local/bin
参考:https://www.bountysource.com/issues/28085261-can-t-write-usr-bin-nokogiri-while-installing-on-mac-os-ei-capitan
#22
0
This worked:
这工作:
gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2 --use-system-libraries
gem安装nokogiri -- -- -- -xml2-include=/Applications/Xcode.app/内容/开发/平台/MacOSX.platform/Developer/SDKs/MacOSX10.11。sdk / usr / include / libxml2——use-system-libraries
源
#23
-1
Try this out:
试试这个:
Install these packages in the given order:
按照给定的顺序安装这些包:
brew install libxml2 libxslt
brew link libxml2 libxslt
gem install nokogiri
Try updating gcc version:
试着更新的gcc版本:
- Update GCC on OSX
- 更新GCC OSX上
- https://superuser.com/questions/517218/how-do-i-install-gcc-4-7-2-on-os-x-10-8
- https://superuser.com/questions/517218/how-do-i-install-gcc-4-7-2-on-os-x-10-8
- Installing libv8 gem on OS X 10.9+
- 在OS X 10.9+上安装libv8 gem。
- libv8 (3.11.8.17) bundle install error on Mac
- libv8(3.11.8.17)包安装错误在Mac上。