Library not loaded: /usr/local/lib/libMagickCore.4.dylib (LoadError) #9

jpsilvashy opened this Issue Mar 29, 2012 · 22 comments


None yet

I installed imagemagick with brew but I'm having a strange issue still:

/Users/jpsilvashy/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick2.bundle: dlopen(/Users/jpsilvashy/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libMagickCore.4.dylib (LoadError)
  Referenced from: /Users/jpsilvashy/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick2.bundle
  Reason: image not found - /Users/jpsilvashy/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick2.bundle
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /Users/jpsilvashy/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:11
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /Users/jpsilvashy/.git_hooks/post-commit//lolcommit:4

Not sure what to do, I tried unlinking and reinstalling imagemagick with no luck.


Are you by any chance using ZSH? I found a reference to a similar problem here:


Also, please try uninstalling and installing the new version (instructions in README), that seems to be helping some people.


I get this error as well. Though, I got this from the old version, which is why I updated.

I get this error when I run lolcommits --enable

Previously, I had been able to use git hook --install w/o error. but the actual capturing would trigger this same exact error. I am using bash. OSX 10.6.8

Okay, so I dug around on my error. And re-installing imagemagick didn't fix it. Specifically, it looks like ruby it throwing a library mismatch error. Ruby is looking for /usr/local/lib/libMagickCore.4.dylib

But, imagemagick via brew install imagemagick installed a newer version: libMagickCore.5.dylib I think I need to somehow tell ruby to use this newer library, but I know very little about gem package management.

dir listing:

aesop ~/Documents/projects/javascript/doMint.js:(master)$ ls /usr/local/lib/libMagick
libMagickCore.5.dylib       libMagickWand.dylib
libMagickCore.dylib    libMagickWand.5.dylib

Here is the complete message:

aesop ~/Documents/projects/javascript/doMint.js:(master)$ lolcommits --enable
/Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libMagickCore.4.dylib (LoadError)
  Referenced from: /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.bundle
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
  from /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/lib/RMagick.rb:11
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
  from /Library/Ruby/Gems/1.8/gems/lolcommits-0.0.2/lib/lolcommits.rb:5
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
  from /Library/Ruby/Gems/1.8/gems/lolcommits-0.0.2/bin/lolcommits:7
  from /usr/bin/lolcommits:19:in `load'
  from /usr/bin/lolcommits:19

@gregory80 Hmm... looks like you have the most recent version of RMagick (2.13.1). Perhaps it needs to rebuilt against the version fo imagemagick you have installed now... does a "gem pristine rmagick" help?


yup, that did it



Looks like that does it then. @jpsilvashy try that, and re-open this issue if that doesn't fix it.

@mroth mroth closed this Apr 16, 2012

OMG, thank you. "gem pristine rmagick" helped!


gem pristine rmagick

fixed it


Well, the same mistake:

$ rails s 
/Users/denis/code/questick/vendor/bundle/gems/rmagick-2.13.1/lib/rmagick.rb:11:in `require': dlopen(/Users/denis/code/questick/vendor/bundle/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libMagickCore.4.dylib (LoadError)
  Referenced from: /Users/denis/code/questick/vendor/bundle/gems/rmagick-2.13.1/lib/RMagick2.bundle
  Reason: image not found - /Users/denis/code/questick/vendor/bundle/gems/rmagick-2.13.1/lib/RMagick2.bundle
    from /Users/denis/code/questick/vendor/bundle/gems/rmagick-2.13.1/lib/rmagick.rb:11:in `<top (required)>'
    from /Users/denis/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `require'
    from /Users/denis/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/denis/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `each'
    from /Users/denis/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/denis/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
    from /Users/denis/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
    from /Users/denis/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
    from /Users/denis/code/questick/config/application.rb:7:in `<top (required)>'
    from /Users/denis/code/questick/vendor/bundle/gems/railties-3.2.1/lib/rails/commands.rb:53:in `require'
    from /Users/denis/code/questick/vendor/bundle/gems/railties-3.2.1/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /Users/denis/code/questick/vendor/bundle/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap'
    from /Users/denis/code/questick/vendor/bundle/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

while using Mac OS X Lion 10.7.4 + brew + zsh + rbenv + bundler. But the unusual thing is that all works good untill i use bundled gem.

What is the solution?



gem pristine rmagick


gem pristine rmagick



Any idea how to fix this for Jmagick?



Rats... gem pristine rmagick is not working for me.

I am still getting:
Referenced from: /usr/local/lib/libMagickCore-Q16.7.dylib
Reason: Incompatible library version: libMagickCore-Q16.7.dylib requires version 11.0.0 or later, but libltdl.7.dylib provides version 10.0.0 - /Users/prettyinstant/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick2.bundle

Any ideas how to fix this?


@afxjzs what version of lolcommits are you using? the rmagick dependency has been replaces in more recent versions.


I've got the same trouble, just don't forget to do a brew update before reinstalling imagemagick


I had this same issue. Needed to ln some things because the new version of Imagemagick has some issues with rmagick compatiblity.


Thank you gem pristine rmagick!


Thank you oh mighty gem pristine!

gem pristine rmagick

Thanks for this, I love you


In an effort to help future googlers, here are the steps I had to take to get this fixed:

  1. brew uninstall imagemagick
  2. brew install imagemagick
  3. gem pristine rmagick

@JoshTGreenwood @cpow I'm confused how you are still running a version of lolcommits that relies upon RMagick, we moved off rmagick (precisely because it caused problems like this) well over a year ago. What version of lolcommits do you have installed? You might want to gem update lolcommits.


+1 gem pristine rmagick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment