Search code examples
ruby-on-railsimagemagickpaperclipx11rmagick

Rails 3 - RMagick doesn't find libfreetype.6.dylib using Paperclip


I'm trying to use Paperclip to upload some image. It's work fine but if I want add some style with :

:styles => { :small => "100x100" }

It does not work anymore, I have this error message :

myImage is not recognized by the 'identify' command.

So, I've found some tips on the web and I've installed ImageMagick with Brew then I've added

gem 'Rmagick'

to my GemFile.

And now when I restart my server, I get this message error :

/usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/rmagick-2.13.1/lib/rmagick.rb:11:in `require': dlopen(/usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/X11/lib/libfreetype.6.dylib (LoadError) Referenced from: /usr/local/lib/libMagickCore.5.dylib Reason: Incompatible library version: libMagickCore.5.dylib requires version 14.0.0 or later, but libfreetype.6.dylib provides version 10.0.0 - /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/rmagick-2.13.1/lib/RMagick2.bundle

I've updated my X11 and installed XQuartz, but nothing to do it's doesn't work anymore. I can restart rails server if I remove

gem 'Rmagick'

from my GemFile.

Any ideas ?

Thank you very much, I've spent 10 hours on this bug without figure out it !!

Bye


Solution

  • Locate your libfreetype.6.dylib eg:

    sudo find / -name "libfreetype.6.dylib" -print
    

    Make sure that your version is 14.0.0 or later (the above is my path on macosx) eg:

    otool -L /usr/X11/lib/libfreetype.6.dylib
    

    If the version is right, maybe you have a library path problem.

    Otherwise an update will fix.