My Coding Adventures

RMagick errors when running Rake Tasks in OS X Maverick

We were running into some issues at work so I decided to pitch in. I had trouble listing my rake tasks as my rake tasks was spitting out this error through RMagick – Reason: image not found – /rmagick-2.13.2/RMagic2.bundle.

The full error was:

rake aborted!
LoadError: dlopen(/Users/kelvin/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-13/2.1.0/rmagick-2.13.2/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libMagickCore-6.Q16.1.dylib
 Referenced from: /Users/kelvin/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-13/2.1.0/rmagick-2.13.2/RMagick2.bundle
 Reason: image not found - /Users/kelvin/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-13/2.1.0/rmagick-2.13.2/RMagick2.bundle

Oddly enough, rmagick seemed to be installed properly and even after uninstalling both imagemagick through HomeBrew and rmagick through gem install, I still couldn’t run my rake task. After trying a few things like running gem pristine rmagick, I found myself on this blog instead. And it worked like a charm. The steps I took were:

brew install libtool --universal
brew link libtool
brew unlink libtool && brew link libtool
gem uninstall rmagick
gem install rmagick

That seem to do the trick for me. You could shorten the step to check to see if you had libtool installed already and then just tried the unlink and relinking.