安装 idb tool。
今天使用gem命令,出现了下面的错误:
Building native extensions. This could take a while...
ERROR: Error installing idb:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/libxml-ruby-3.0.0/ext/libxml
/usr/local/opt/ruby/bin/ruby -r ./siteconf20170221-5409-1vufyx7.rb extconf.rb
/usr/local/opt/ruby/bin/ruby: warning: shebang line ends with \r may cause a problem
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** 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=/usr/local/Cellar/ruby/2.4.0/bin/$(RUBY_BASE_NAME)
--with-xml2-config
--without-xml2-config
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
extconf failure: need libxml2.
Install the library or try one of the following options to extconf.rb:
--with-xml2-config=/path/to/xml2-config
--with-xml2-dir=/path/to/libxml2
--with-xml2-lib=/path/to/libxml2/lib
--with-xml2-include=/path/to/libxml2/include
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-15/2.4.0/libxml-ruby-3.0.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/libxml-ruby-3.0.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-15/2.4.0/libxml-ruby-3.0.0/gem_make.out
想了很久,Google 很久,还是没得进展。
---------替换gem 默认地址----------
会想起上个os 版本,我安装swift的相关东西,需要将gem的sources更换。
国内 访问:https://rubygems.org/ 有限制。
执行下面的命令: 删除原有sources 源。
**deMacBook-Air:~ $ gem sources --remove https://rubygems.org/
https://rubygems.org/ removed from sources
**deMacBook-Air:~ $ gem sources -a https://ruby.taobao.org/
https://ruby.taobao.org/ added to sources
再执行安装。搞定: