2015-11-03 81 views
-1

使用installrails.com安装滑轨,直到我去的第一步,一切工作正常:无法在OSX El Capitan上安装导轨?

gem install rails --no-ri --no-rdoc 

打字后,端子输出:

users-MacBook:~ user$ 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/user/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20151102- 1332-1uwdkth.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 
--without-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/user/.rvm/rubies/ruby-2.2.1/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/user/.rvm/gems/ruby- 2.2.1/gems/nokogiri-1.6.6.2 for inspection. 
Results logged to /Users/user/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.6.2/gem_make.out 
users-MacBook:~ user$ 

一些研究,我发现我也许能后通过安装Xcode命令行工具来修复它,但我需要进一步的帮助。

+3

你运行过'xcode-select --install'吗? – doublesharp

+0

如果您阅读完整的错误消息,它会告诉您到底需要做什么:) – doublesharp

回答

2

错误消息告诉你到底出了什么问题:

文件“/usr/include/iconv.h”在构建环境中缺少, 这意味着你还没有安装的Xcode命令行正确的工具。

,以及如何解决这个问题:

要安装的命令行工具,尝试 终端运行xcode-select --install,并按照指示。如果失败,请打开Xcode.app, 从菜单“Xcode” - “Open Developer Tool” - “更多开发人员 工具”中选择以打开开发人员站点,下载OS 版本的安装程序并运行它。

请检查:

  1. 你已经安装的Xcode?
  2. 您是否安装了Xcode命令行工具?
  3. 您是否至少打开过一次Xcode(每次更新后再次打开)并且您是否接受许可证?
+0

非常好。这帮助我安装了appium控制台('gem install --no-rdoc --no-ri appium_console'),因为我在El Capitan上遇到了同样的错误 –