2013-09-26 97 views
7

(编辑:请参阅解决方案的底部)我正在做一个Ruby On Rails项目,并且正在尝试安装RMagick gem。使用OS X 10.6,Ruby版本2.0.0p247,Rails 4.0.0,RVM 1.22.12。Ruby on Rails RMagick的宝石安装问题

当我运行一个捆绑安装我收到以下错误:

... 
Installing rmagick (2.13.2) 
Errno::EACCES: Permission denied - /Users/jasonpather/.rvm/gems/ruby-2.0.0-p247/g 
ems/rmagick-2.13.2/build_tarball.rake 
An error occurred while installing rmagick (2.13.2), and Bundler cannot continue. 
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling. 

于是我尝试了建议:

Jason-Pathers-MacBook-Pro:BuyABrick jasonpather$ gem install rmagick -v '2.13.2' 
ERROR: While executing gem ... (Errno::EACCES) 
Permission denied - /Users/jasonpather/.rvm/gems/ruby-2.0.0-p247/gems/rmagick 
-2.13.2/build_tarball.rake 

于是我尝试须藤:

Jason-Pathers-MacBook-Pro:BuyABrick jasonpather$ sudo gem install rmagick -v '2.1 
3.2' 
Password: 
Building native extensions. This could take a while... 
ERROR: Error installing rmagick: 
    ERROR: Failed to build gem native extension. 

/Users/jasonpather/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb 
checking for Ruby version >= 1.8.5... yes 
checking for gcc-4.2... yes 
checking for Magick-config... no 
Can't install RMagick 2.13.2. Can't find Magick-config in /Users/jasonpather/.rvm 
/gems/ruby-2.0.0-p247/bin:/Users/jasonpather/.rvm/gems/[email protected]/bin 
:/Users/jasonpather/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/jasonpather/.rvm/gems/ 
ruby-2.0.0-p247/bin:/Users/jasonpather/.rvm/gems/[email protected]/bin:/User 
s/jasonpather/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/jasonpather/.rvm/bin:/opt/lo 
cal/bin:/opt/local/sbin:/opt/local/lib/postgresql83/bin/:/usr/local/bin:/usr/bin: 
/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/texbin:/usr/X11/bin 

*** 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=/Users/jasonpather/.rvm/rubies/ruby-2.0.0-p247/bin/ruby 


Gem files will remain installed in /Users/jasonpather/.rvm/gems/ruby-2.0.0-p247/g 
ems/rmagick-2.13.2 for inspection. 
Results logged to /Users/jasonpather/.rvm/gems/ruby-2.0.0-p247/gems/rmagick-2.13. 
2/ext/RMagick/gem_make.out 

我非常感谢任何帮助。我在这个网站上看过类似的问题,但没有任何建议有帮助。在安装RMagick之前,我是否需要安装其他软件包?

编辑:解

我只是用自制安装ImageMagick的brew install imagemagick然后sudo gem install rmagick现在bundle install运行正常!

+0

此问题的建议无效? http://stackoverflow.com/q/3704919/1004046 – Pigueiras

+1

首先安装'ImageMagic'。 Howto:http://www.imagemagick.org/script/binary-releases.php#macosx –

+0

@YevgeniyAnfilofyev我想现在,我按照该页面上的说明,但是当我尝试运行'convert logo:logo .gif'告诉我“非法指令”和“捆绑安装”会引发相同的错误。即使在说明中说明了Mountain Lion,您链接的方法是否会与Snow Leopard 10.6一起工作?编辑:根据[本](http://stackoverflow.com/questions/2503172/imagemagick-on-mac-osx-snow-leopard-is-there-any-way-to-get-it-to-compile-和-r)这个二进制文件是Lion-only :( –

回答

8

你需要安装Image Magick(你的日志中的checking for Magick-config... no表明)。

最简单的方法(因为你在Mac上)是Homebrew。安装家酿(按照它为您提供了安装过程中的任何指示 - 它们不是很多),然后只需运行:

brew install imagemagick

然后再次运行bundle install

+0

是的,你是对的我试过了,成功就是结果!然后我用'sudo gem install rmagick'然后'bundle install'工作! –