2013-09-26 92 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'工作! –