ruby-on-rails - 在 Maverick 的 Rails 中安装 Ruby 时出错

标签 ruby-on-rails rubygems extconf.rb

我已经尝试了针对此处发布的类似问题提供的多种解决方案,但似乎没有任何效果。我无法安装 Rails。错误信息如下。另外,Wwen 我尝试使用 xcode-select --install 安装 Xcode,它给了我一个网络 cannot download due to network 的安装请指教。我对 Ruby 很陌生,所以任何帮助都将不胜感激。干杯。

nmacaule-mn1:~ nmacaule$ 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.

    /Users/nmacaule/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150209-56320-1m9byas.rb 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.
-----

The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.

To install Command Line Tools, try running `xcode-select --install` on
terminal and follow the instructions.  If it fails, open Xcode.app,
select from the menu "Xcode" - "Open Developer Tool" - "More Developer
Tools" to open the developer site, download the installer for your OS
version and run it.
-----
*** 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/nmacaule/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME)
    --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

Gem files will remain installed in /Users/nmacaule/.rvm/gems/ruby-2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/nmacaule/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-13/2.2.0/nokogiri-1.6.6.2/gem_make.out

最佳答案

运行此命令:

xcode-select --install

关于ruby-on-rails - 在 Maverick 的 Rails 中安装 Ruby 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28412433/

相关文章:

ruby - 在 ruby 中分离出猴子斑 block ?

c++ - 我如何指示 extconf.rb 使用额外的 g++ 优化标志,哪些是可取的?

ruby-on-rails - 创建和更新 Mongoid 数组字段的表单

ruby-on-rails - Rails 3 模型,belongs_to 不同的表只在每条记录中

ruby-on-rails - 未定义的方法 `gsub' 为 nil :NilClass

ruby-on-rails - 使用 RABL 从 Rails 3 应用程序返回不完整的响应正文

ruby - "bourbon"的导入在 Je​​kyll 设置中不起作用

ruby - 是否可以直接从 git 存储库安装 gem?