OS X 10.6安装引入nokogiri
问题描述:
我很新的OS X和我不知道如何编译,MacPorts的,自制等。所有我想要做的是安装在OS XOS X 10.6安装引入nokogiri
的引入nokogiri创业板什么Windows中,这是简单的:
gem install nokogiri
然而,当我尝试这在OS X上,我得到以下信息:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
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.4.4 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/nokogiri-1.4.4/ext/nokogiri/gem_make.out
同样,我也不是很不错的OS X和我不知道这是什么意思。
有没有一种简单的方法来安装Nokogiri,而不必捣乱MacPorts和我在线阅读过的其他程序?
我安装了XCode 4(有人说XCode是需要这个工作的),我使用Ruby 1.8.7。
而且,我尝试安装的MacPorts和网上按照指示,我得到如下:
Derek-MacBook-Pro:~ derek$ sudo port install libxml2 libxslt
Password:
---> Computing dependencies for libxml2Error: Unable to execute port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?
To report a bug, see <http://guide.macports.org/#project.tickets>
答
我有一台Macbook豹,我放弃了使用的MacPorts与Rails的前一段时间。让MacPorts与Ruby,宝石等一起玩的痛苦。我切换到RVM(Ruby版本管理器),它允许安装多个版本的Ruby和gems,这样你就可以在一个版本的Ruby上加上一个应用程序加上一些版本的gems,以及在不同版本的ruby和gems上运行的另一个应用程序。
就像rvm install 1.9.2
一样简单。
另外,我在我的生产机器上运行FreeBSD。当我运行RVM时,我可以在我的Macbook上保存运行在我的Macbook上的相同版本的Gems,就像在我的Macbook上安装RVM一样,在我的生产机器上安装RVM。
答
我发现我需要安装UNIX dev。来自XCode的工具,我以前没有做过。现在我在我的问题中列出的MacPorts命令起作用,一旦我成功安装了libxml2,我没有遇到命令sudo gem install nokogiri
的问题。
XCode是最新的,这是非常重要的。雪豹DVD上的版本被破坏。从苹果的XCode网站下载当前的XCode,并安装它,如果它更新。这是一个大文件,所以下载需要一段时间。 – 2011-03-31 23:55:47