[英]Can't install rails on OSX El Capitan?
使用installrails.com安裝rails,一切正常,直到進入第一步:
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命令行工具來修復它,但是我需要進一步的幫助。
該錯誤消息告訴您確切的錯誤原因:
構建環境中缺少文件“ /usr/include/iconv.h”,這意味着您沒有正確安裝Xcode命令行工具。
以及如何解決問題:
要安裝命令行工具,請嘗試在終端上運行
xcode-select --install
並按照說明進行操作。 如果失敗,請打開Xcode.app,從菜單“ Xcode”-“打開開發人員工具”-“更多開發人員工具”中選擇以打開開發人員站點,下載適用於您的OS版本的安裝程序並運行它。
請檢查:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.