I've got a clean instal of Mac OS X Lion, and I've installed the Developer Tools. I'm trying to install some ruby gems and the ones which need native extensions aren't building.
我已经安装了Mac OS X Lion,我已经安装了开发人员工具。我正在尝试安装一些红宝石宝石,而那些需要原生扩展的宝石并没有建立。
sudo gem install rmagick
For example will not build. I get back this error:
例如,不会建立。我收回了这个错误:
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
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
It looks like the ruby.h header file has moved in Lion, but I don't know how to point ruby gems to it.
看起来ruby.h头文件已经在Lion中移动了,但我不知道如何将ruby gems指向它。
I've also updated rubygems itself with
我也用更新了rubygems本身
sudo gem update --system
But the issue persists. Ideas?
但问题仍然存在。想法?
1 个解决方案
#1
3
First, if you're still using sudo gem
, you should probably switch to RVM, which manages lots of rubies and gemsets, all in your home directory so there's no permission problems, and cleanly switches between them.
首先,如果您仍在使用sudo gem,您应该切换到RVM,它管理大量的rubies和gemsets,所有这些都在您的主目录中,因此没有权限问题,并且在它们之间干净地切换。
RVM: http://rvm.beginrescueend.com
Second, even though you say you "installed the Developer Tools" you may not have gotten XCode and all the libraries. These days XCode for Lion is available on the Mac App Store -- for free, thankfully, though it was $4.99 for a few months, and annoyingly, the Leopard and Snow Leopard compatible versions of XCode are not on the Mac App Store.
其次,即使您说“安装了开发人员工具”,您也可能没有获得XCode和所有库。目前,XCode for Lion可以在Mac App Store上购买 - 幸运的是,虽然几个月只需4.99美元,但令人讨厌的是,Leopard和Snow Leopard兼容版本的XCode不在Mac App Store上。
XCode: http://itunes.apple.com/us/app/xcode/id448457090?mt=12
Third, rmagick depends on ImageMagick. The easiest way to get that these days is via HomeBrew (MacPorts had its day, but everybody's brewing now).
第三,rmagick依赖于ImageMagick。这些天最简单的方法是通过HomeBrew(MacPorts有一天,但现在每个人都在酝酿)。
HomeBrew: http://mxcl.github.com/homebrew/
After all that, the following should work (and just now worked for me on my Lion laptop):
毕竟,以下应该工作(并且刚刚在我的Lion笔记本电脑上为我工作):
brew install imagemagick
gem install rmagick
#1
3
First, if you're still using sudo gem
, you should probably switch to RVM, which manages lots of rubies and gemsets, all in your home directory so there's no permission problems, and cleanly switches between them.
首先,如果您仍在使用sudo gem,您应该切换到RVM,它管理大量的rubies和gemsets,所有这些都在您的主目录中,因此没有权限问题,并且在它们之间干净地切换。
RVM: http://rvm.beginrescueend.com
Second, even though you say you "installed the Developer Tools" you may not have gotten XCode and all the libraries. These days XCode for Lion is available on the Mac App Store -- for free, thankfully, though it was $4.99 for a few months, and annoyingly, the Leopard and Snow Leopard compatible versions of XCode are not on the Mac App Store.
其次,即使您说“安装了开发人员工具”,您也可能没有获得XCode和所有库。目前,XCode for Lion可以在Mac App Store上购买 - 幸运的是,虽然几个月只需4.99美元,但令人讨厌的是,Leopard和Snow Leopard兼容版本的XCode不在Mac App Store上。
XCode: http://itunes.apple.com/us/app/xcode/id448457090?mt=12
Third, rmagick depends on ImageMagick. The easiest way to get that these days is via HomeBrew (MacPorts had its day, but everybody's brewing now).
第三,rmagick依赖于ImageMagick。这些天最简单的方法是通过HomeBrew(MacPorts有一天,但现在每个人都在酝酿)。
HomeBrew: http://mxcl.github.com/homebrew/
After all that, the following should work (and just now worked for me on my Lion laptop):
毕竟,以下应该工作(并且刚刚在我的Lion笔记本电脑上为我工作):
brew install imagemagick
gem install rmagick