在Mac OS X(Yosemite)上安装导轨时遇到问题

时间:2015-03-28 03:39:59

标签: ruby-on-rails ruby nokogiri yosemite

我正在尝试在Mac OS X(Yosemite)上安装rails。 我收到以下错误:

Mohammads-iMac:~ mohammadriazi$ gem install rails --no-ri --no-rdoc
Building native extensions.  This could take a while... ERROR:  Error
installing rails:   ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
extconf.rb checking if the C compiler accepts ... yes checking if the
C compiler accepts
-Wno-error=unused-command-line-argument-hard-error-in-future... no 
Building nokogiri using packaged libraries. checking for gzdopen() in
-lz... yes checking for iconv... yes
************************************************************************ IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.2 with the
following patches applied:
    - 0001-Revert-Missing-initialization-for-the-catalog-module.patch
    - 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.

我确实尝试更新gem,但我仍然得到错误。 我也安装了家酿

请帮忙! 感谢

1 个答案:

答案 0 :(得分:0)

感谢指点家伙们! 我在这里读到这篇文章: https://github.com/sstephenson/rbenv#homebrew-on-mac-os-x

这帮助我理解了rbenv。

  • 然后我将我的rbenv和Homebrew更新为最新版本。
  • 将我的默认ruby版本设置为可用的最新版本。 (我想我的MAC OS X上安装的系统Ruby是默认的,这导致了问题)
  • 最后我使用gem来安装最新版本的rails,然后再进行rehash。

现在一切都很棒! 感谢