OS X 10.6安装Nokogiri [英] OS X 10.6 Installing Nokogiri

查看:88
本文介绍了OS X 10.6安装Nokogiri的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对OS X非常陌生,对编译,MacPorts,Homebrew等一无所知。我想要做的就是在OS X上安装Nokogiri gem。



在Windows中,它非常简单:

  gem install nokogiri 


<$>

<$> p $ p> 构建原生扩展。这可能需要一段时间...
错误:安装nokogiri时出错:
错误:无法构建gem本机扩展。

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb无法找到ruby的头文件在/ System / Library / Frameworks / Ruby.framework / Versions / 1.8 / usr / lib / ruby​​ / ruby​​.h

Gem文件将保存在/Library/Ruby/Gems/1.8/gems/nokogiri-1.4中。 4进行检查。
结果记录到/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 
密码:
--->计算libxml2Error的依赖关系:无法执行端口:无法读取build.cmd:未能在路径中找到'make':'/ opt / local / bin:/ opt / local / sbin:/ bin:/ sbin: / usr / bin:/ usr / sbin'或在其MacPorts配置时间位置,您是否移动它?
要报告错误,请参阅< http://guide.macports.org/#project.tickets>


解决方案

我有Leopard的Macbook,在前段时间使用MacPorts与Rails。让MacPorts与Ruby,宝石等一起玩的痛苦。我切换到RVM(Ruby版本管理器),它允许安装Ruby和gems的多个版本,以便您可以在一个版本的Ruby上加上一个应用程序加上一些版本的gems,以及在不同版本的ruby和gems上运行的另一个应用程序。



它就像 rvm install 1.9.2



另外,我在我的生产机器上运行FreeBSD。当我运行RVM时,我可以保持运行在我的Macbook上的相同版本的Gems,就像我在生产机器上运行的一样,在我的生产机器上安装RVM的方式与我在Macbook上的方式相同。


I am very new to OS X and I don't know anything about compiling, MacPorts, Homebrew, etc. All I want to do is install the Nokogiri gem on OS X.

In Windows, it was as simple as:

gem install nokogiri

However, when I try this on OS X, I get the following message:

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

Again, I am not very good with OS X and I have no idea what this means.

Is there an easy way to install Nokogiri without having to mess with MacPorts and other programs I've read about online?

I have XCode 4 installed (some people say XCode is required for this to work), and I'm using Ruby 1.8.7.

Also, I tried installing MacPorts and following the instructions online and I get the following:

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>

解决方案

I have a Macbook with Leopard, and I gave up on using MacPorts with Rails some time ago. The pain of getting MacPorts to play along with Ruby, gems, etc., yikes. I switched to RVM (Ruby Version Manager), which allows for installing multiple versions of Ruby and gems, so that you can run one app on one version of Ruby plus some versions of gems, and a different app on different versions of ruby and gems.

It's as simple as rvm install 1.9.2.

Also, I run FreeBSD on my production machine. When I run RVM, I can keep the same versions of gems running on my Macbook, as are running on my production machine by installing RVM on my production machine the same way I have it on my Macbook.

这篇关于OS X 10.6安装Nokogiri的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆