Ruby on rails Rails不会安装在我的Mac上

Ruby on rails Rails不会安装在我的Mac上,ruby-on-rails,ruby,xcode,macos,ruby-on-rails-3,Ruby On Rails,Ruby,Xcode,Macos,Ruby On Rails 3,每当我尝试在Mac上安装Rails时,它都可以正常工作,但当我尝试查看Rails的版本时,终端会说我没有安装Rails 以下是我在终端中看到的内容: admins-MBP-5:~ Programming$ sudo gem install rails Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem nativ

每当我尝试在Mac上安装Rails时,它都可以正常工作,但当我尝试查看Rails的版本时,终端会说我没有安装Rails

以下是我在终端中看到的内容:

admins-MBP-5:~ Programming$ sudo gem install rails
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.
-----
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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/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


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out
admins-MBP-5:~ Programming$ rails --version
Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

You can then rerun your "rails" command.
嗯,“很好用”???不,根本没有-安装失败了,因为当前的Rails需要nokogiri gem

阅读并按照“文件“/usr/include/iconv.h”开头的说明进行操作

The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.
这些行说明您还没有安装XCode,这对许多控制台实用程序都是必要的


此外,您还可以使用sudo安装gems-这可能会在以后的权限中导致一些问题。我建议您使用来管理ruby安装,它将在将来为您避免许多问题。

学习阅读错误消息将在将来对您有很大帮助

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.
该文本在您自己的错误消息中,请尝试一下。安装Xcode后,请再次尝试安装Rails