ruby-on-rails – 在El Capitan上安装Rails时找不到-lgmp错误的库(Mac OS 10.11.1(15B42))

Ruby v2.2.2上在El Capitan(Mac OS X 10.11.1)上安装Rails时,出现以下错误
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /Users/jon/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20151117-26799-ux15fd.rb extconf.rb --use-system-libraries
checking if the C compiler accepts ... *** 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.

并且mkmf.log文件具有:

$cat /Users/jon/.rvm/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/nokogiri-1.6.6.3/mkmf.log 
"gcc -o conftest -I/Users/jon/.rvm/rubies/ruby-2.2.2/include/ruby-2.2.0/x86_64-darwin14 ...
-lruby.2.2.0  -lpthread -lgmp -ldl -lobjc  "
ld: library not found for -lgmp
clang: error: linker command Failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc,char **argv)
4: {
5:   return 0;
6: }
/* end */

解决方法

固定
xcode-select --install

并重新运行gem安装rails工作.

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...