RMagick complaining about libMagickCore.5.dylib not found in OSX

对着背影说爱祢 提交于 2020-01-22 13:22:06

问题


after running brew upgrade imagemagick, when I run rails s I'll get

/Users/tomi/.rvm/gems/ruby-2.0.0-p247@ezaaa/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': dlopen(/Users/tomi/.rvm/gems/ruby-2.0.0-p247@ezaaa/gems/rmagick-2.13.2/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libMagickCore.5.dylib (LoadError)
  Referenced from: /Users/tomi/.rvm/gems/ruby-2.0.0-p247@ezaaa/gems/rmagick-2.13.2/lib/RMagick2.bundle
  Reason: image not found - /Users/tomi/.rvm/gems/ruby-2.0.0-p247@ezaaa/gems/rmagick-2.13.2/lib/RMagick2.bundle

I'm using Carrierwave gem with RMagick, OS is OSX Moutain Lion


回答1:


Anyone else struggling with this right now (Jan 2017) - RMagick 2.15.4 can't be built with ImageMagick 7.0.x

First, please do this:

brew uninstall ImageMagick
gem uninstall rmagick

Second, please see https://github.com/rmagick/rmagick/issues/256 and read the answer by hristozov, viz:

brew rm imagemagick
cd "$(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/"
git checkout 6f014f2b7f1f9e618fd5c0ae9c93befea671f8be imagemagick.rb
brew install imagemagick
brew pin imagemagick
git reset --hard

This will force homebrew to use /usr/local/Cellar/imagemagick/6.9.7-3

Third,

gem install rmagick



回答2:


thx to bit unrelated answer found here I manage to fix this by:

1/ search for this lib in the system

sudo find / -name "libMagickCore.5.dylib" -print

I found mine in /usr/local/Cellar/imagemagick/6.7.7-6/lib/libMagickCore.5.dylib

2/ link this library to required path

ln /usr/local/Cellar/imagemagick/6.7.7-6/lib/libMagickCore.5.dylib /usr/local/lib/libMagickCore.5.dylib



回答3:


1 brew uninstall ImageMagick

2 brew install ImageMagick

3 gem uninstall rmagick (all versions)

4 gem install rmagick

worked for me




回答4:


Big thanks! I had the same problem:

$ perl -le 'use Image::Magick'

Can't load '/Library/Perl/5.16/darwin-thread-multi-2level/auto/Image/Magick/Magick.bundle' for module Image::Magick: dlopen(/Library/Perl/5.16/darwin-thread-multi-2level/auto/Image/Magick/Magick.bundle, 1): Library not loaded: /usr/local/lib/libMagickCore-6.Q16.1.dylib
Referenced from: /Library/Perl/5.16/darwin-thread-multi-2level/auto/Image/Magick/Magick.bundle Reason: image not found at /System/Library/Perl/5.16/darwin-thread-multi-2level/DynaLoader.pm line 194. at -e line 1. Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1. &Image::Magick::constant not defined. The required ImageMagick libraries are not installed or not installed properly. END failed--call queue aborted at -e line 1.

And after:

$ sudo find / -name "libMagickCore-6.Q16.1.dylib" -print

/usr/local/Cellar/imagemagick/6.8.7-7/lib/libMagickCore-6.Q16.1.dylib

I created a symlink:

$ ln -s /usr/local/Cellar/imagemagick/6.8.7-7/lib/libMagickCore-6.Q16.1.dylib /usr/local/lib/libMagickCore-6.Q16.1.dylib

And removed and installed all the imagemagick dependences:

$ brew install perlmagick

==> Installing dependencies for perlmagick: libpng, imagemagick

And everything works now.




回答5:


Just this helped me:

gem pristine rmagick

Thanks to https://github.com/mroth/lolcommits/issues/9#issuecomment-5153570



来源:https://stackoverflow.com/questions/19040932/rmagick-complaining-about-libmagickcore-5-dylib-not-found-in-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!