2014-06-08 104 views
5

我想通过Yosemite上的RVM安装Ruby on Rails。一切似乎已经奏效,不过,当我尝试运行“包安装”我带有与引入nokogiri的错误:在优胜美地上安装Nokogiri

pauls-air:~ paulmcguane$ gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/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 with: '--with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/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' 
This could take a while... 
Building nokogiri using packaged libraries. 
ERROR: Error installing nokogiri: 
    ERROR: Failed to build gem native extension. 

的错误信息是:

/Users/paulmcguane/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb 
Building nokogiri using packaged libraries. 
----- 
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies. 
----- 
*** 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/paulmcguane/.rvm/rubies/ruby-2.1.2/bin/ruby 
     --help 
     --clean 
     --use-system-libraries 
     --enable-static 
     --disable-static 
     --with-zlib-dir 
     --without-zlib-dir 
     --with-zlib-include 
     --without-zlib-include=${zlib-dir}/include 
     --with-zlib-lib 
     --without-zlib-lib=${zlib-dir}/lib 
     --enable-cross-build 
     --disable-cross-build 

extconf failed, exit code 1 
+0

你或许应该让引入nokogiri使用LIB XML其捆绑的版本,而不是强迫使用一个你已经安装了(虽然它看起来像它可能会这样做)另外,应该在错误消息中提及具有精确编译错误的日志文件。 –

+1

尚未在优胜美地上安装。但我会重新开始使用新的gemset,并确保Nokogiri已列入导轨(或任何其他宝石)。这可以确保Nokogiri使用它的嵌入式libxml2(这可以阻止您在第一个孩子时遇到问题)。另见https://github.com/sparklemotion/nokogiri/issues/742#issuecomment-9082139和https://github.com/sparklemotion/nokogiri/issues/829 –

+0

你可以试试这个答案:http:// stackoverflow。 com/questions/24091869 /正在安装nokogiri-on-osx-10-10-yosemite?answertab = active#tab-top – activars

回答

3

我只是完成了Rails和Ruby的全部安装以及您需要的一切。我遵循了这些步骤。

https://gorails.com/setup/osx/10.10-yosemite

,并使用以下安装引入nokogiri

xcode-select --install 
gem install nokogiri 
bundle config build.nokogiri --use-system-libraries 
bundle install 
+2

美丽。只需要第一行'xcode-select --install',然后我就可以'捆绑安装'而没有问题。 – colllin

0

我这使用macports而不是自制软件。我的配置:

  1. 安装最新的Xcode测试版(Beta 3在写作时)。从源
  2. xcode-select --switch /Applications/Xcode-Beta3
  3. MacPorts的内置/安装,每安装说明here
  4. sudo port install libxml2 libxslt
  5. gem install nokogiri -- --with-iconv-include=/opt/local/include/

有点令人费解,但一切的工作之后的罚款。