8
votes

Okay, I have imagemagick installed on my local machine via homebrew, and Gemfile.lock shows paperclip locked at version paperclip (3.0.4).

Per the setup instructions, I set the following command in development.rb

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

Which lines up with what the terminal says

$ which identify
  # => /usr/local/bin/identify

However, when I try to upload an image, the following error spits out on my form

/var/folders/dm/lnshrsls2zz6l4r_tkbk7j2w0000gn/T/avatar20120522-44111-gfis2q.jpg is not recognized by the 'identify' command.

Which every SO question I can find on the matter suggests the problem is Paperclip can't find identify in it's command path.

I used the Paperclip generator to add the avatar to my database, and my model has:

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

Furthermore, if I load up rails c and look at Paperclip.options, I can see the command path has been properly set in the hash.

Not quite sure what to do at this point. Any help would be appreciated.

3
does the identify command actually run from the command prompt? e.g. $ identify -versionIvan
It returns dyld: Library not loaded: /usr/local/lib/libtiff.3.dylib Referenced from: /usr/local/bin/identify Reason: image not found Trace/BPT trap: 5DVG
Do you know if you have /usr/local/lib included for your ld.so conf? if your running Ubuntu (and probably other Linux dists) you should make sure /usr/local/lib is in some file in /etc/ld.so.conf.d (default the libc seams to include it, if I haven't added it manually, dont remember). Then run ldconfig as root and restart the web server.Mattias Wadman
Running OS X, as near as I can tell, ld.so.conf isn't a thing over here.DVG
Ah ok. Does /usr/local/lib/libtiff.3.dylib really exist? have you fiddled with any DYLD_* environment variables? (check man dydl, /usr/local/lib is included in the default fallback search paths).Mattias Wadman

3 Answers

10
votes

I'm glad that running the command got you started on the right path.

The problem was that your ImageMagick was compiled for the wrong architecture:

dyld: Library not loaded: /usr/local/lib/libtiff.3.dylib Referenced from: /usr/local/bin/identify Reason: image not found Trace/BPT trap

Uninstalling imagemagick, updating homebrew and reinstalling it was the right thing to do.

4
votes

Just in case, I made it work with this trick:

ln -s /usr/local/Cellar/libtiff/3.9.5/lib/libtiff.3.dylib /usr/local/lib/libtiff.3.dylib

And is working like charm :)

0
votes

Not quite sure what the exact problem was, however I uninstalled Image Magick, updated Homebrew and reinstalled imagemagick and now everything is working.