Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Imagemagick issue on Lion installed with Homebrew

I am trying to use the Paperclip gem on a Rails project so followed the docs and first installed Imagemagick using the Homebrew recipe.

I added to my model my attachment

has_attached_file :screenshot

This worked OK and the file uploads functioned as expected

I then wanted to add thumbnails to this, so again followed the docs and added to the model

  has_attached_file :screenshot, 
                :styles => { :medium => "300x300>",
                             :thumb => "100x100>" }

At this point the uploads no longer worked

I check the development logs and noticed this:

[32mCommand[0m :: identify -format %wx%h '/var/folders/ky/r5gsdhbn6yggbglsg727cc900000gn/T/stream20120302-60051-eh17n7.png[0]'
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError:     
/var/folders/ky/r5gsdhbn6yggbglsg727cc900000gn/T/stream20120302-60051-eh17n7.png is not recognized by the 'identify' command.>

At which point after some googling I thought it might be a problem with setting the default path as an environment variable

Paperclip.options[:command_path] = "/usr/local/bin/"

But I checked that this was correct using

which identify

And it returned this path

/usr/local/bin/identify

As expected

I then tried to run identify from the command line as a test and got this error

dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
  Referenced from: /usr/local/bin/identify
  Reason: Incompatible library version: identify requires version 14.0.0 or later, but libfreetype.6.dylib provides version 13.0.0
Trace/BPT trap: 5

So I think my problem is not with paperclip, but rather the install of imageMagick via homebrew

I've tried everything suggested including

brew update
brew remove imagemagick
brew install imagemagick

But it hasn't helped i'm running Lion 10.7.2 and have installed the developer tools.

Any suggestions would be very much appreciated.

like image 426
Chris Avatar asked Mar 02 '12 16:03

Chris


3 Answers

There's a simpler solution. Either install freetype:

brew install freetype

or, if it's already installed, then you need to recreate the links:

brew unlink freetype && brew link freetype

this will fix everything for you. Well, not everything, but it'll at least fix this problem.

like image 149
George Avatar answered Nov 14 '22 10:11

George


I ran into the same issue. Running a software update on the operating system resolved it for me. The version of libfree is out of date. Paperclip, ImageMagick and Homebrew were all working fine.

like image 40
jmejia Avatar answered Nov 14 '22 10:11

jmejia


After a software update on OSX MoutainLion ImageMagick stopped working for me too, but simply following the steps taken by Chris worked:

brew update
brew remove imagemagick
brew install imagemagick
like image 43
jfdimark Avatar answered Nov 14 '22 10:11

jfdimark