gem安装Rails失败

使用gem install rails出现下面的信息:

Building native extensions. This could take a while...

ERROR: Error installing rails:

ERROR: Failed to build gem native extension.

/Users/catcoder/.rvm/rubies/ruby-2.1.3/bin/ruby -r ./siteconf20150512-38048-1seathp.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/catcoder/.rvm/rubies/ruby-2.1.3/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
Gem files will remain installed in /Users/catcoder/.rvm/rubies/ruby-2.1.3/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/catcoder/.rvm/rubies/ruby-2.1.3/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0/nokogiri-1.6.6.2/gem_make.out

安装上方的说明,输入xcode-select --install,会弹出窗体,安装xcode命令行编译工具,等待安装完成,重新安装rails,可以正常进行。

等待一段时间安装完毕,执行:


rails -v

返回:Rails 4.2.1,表明安装成功。

[]

你可能感兴趣的:(gem安装Rails失败)