Cannot installing mechanize for ruby on mac

◇◆丶佛笑我妖孽 提交于 2019-12-11 09:58:44

问题


I am trying to install mechanize on a Mac OS X Version 10.7.3 with ruby version 1.8.7. The problem is with one of its dependencies nokogiri. I have seen other posts about having xcode installe and I do it is version 4.3.2 . Here is the error I am receiving. Thank you in advance.

sudo gem install mechanize
Building native extensions.  This could take a while...
ERROR:  Error installing mechanize:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/nokogiri-1.5.2 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/nokogiri-1.5.2/ext/nokogiri/gem_make.out

回答1:


I needed to simply install the command line tools for xcode and it went smooth. The nokogiri gem has to be compiled.




回答2:


what about this:

pip install mechanize

or

easy_install mechanize



来源:https://stackoverflow.com/questions/10768586/cannot-installing-mechanize-for-ruby-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!