1

I've updated my mac to 10.9.2 (mavericks) and my rails / homebrew environment has fallen apart. I've battled through most of the issues but I'm stuck trying to get paperclip to use ImageMagick. It worked last week but I have changed a few things getting other things to work.

# gem file
gem "paperclip", "~> 4.1"

#model
   has_attached_file     :cover,
   :styles => { :medium => "600x300>", :thumb => "100x100>" },
   :url => "/assets/providers/:id/:style/:basename.:extension",
   :path => ":rails_root/public/assets/providers/:id/:style/:basename.:extension"

  validates_attachment_content_type :cover, :content_type => ['image/jpeg', 'image/png']
  validates_attachment_size :cover, :less_than => 5.megabytes
  before_validation :clear_cover

I'm getting the error message:

Cover Paperclip::Errors::NotIdentifiedByImageMagickError

Since there where a lot of issues after the update with libraries not installed / found i tried to install ImageMagick again but got:

Warning: imagemagick-6.8.9-1 already installed

so i tried

brew uninstall imagemagick
brew install imagemagick

which took suspiciously little time:

Already downloaded: /Library/Caches/Homebrew/imagemagick-6.8.9-1.mavericks.bottle.tar.gz
==> Pouring imagemagick-6.8.9-1.mavericks.bottle.tar.gz
  /usr/local/Cellar/imagemagick/6.8.9-1: 1432 files, 22M

I've seen some suggestions around SO & the web, none of which worked:

brew install ghostscript
brew install libtool

Thanks to suggestion in comments I tried to run:

$ identify -format '%wx%h,1' 'test.jpg'

but got:

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

I'm not sure what the best fix is?

I read this post which adds a symlink to the library, but is that just a patch or a proper fix?

I tried to do:

$ brew install libtool --universal

but got

Warning: libtool-2.4.2 already installed

I ran

$ brew install imagemagick --build-from-source

and after a few troubles got that to happen, but now we get a new error:

identify: no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/501.

It might be worth noting I get the exact same issue on my macbook & my desktop.

halfer
  • 19,824
  • 17
  • 99
  • 186
Will
  • 4,498
  • 2
  • 38
  • 65
  • which convert and which identify returned nothing, so i tried: brew unlink imagemagick && brew link imagemagick – Will May 15 '14 at 04:38
  • now i get ➜ rails git:(aa) ✗ which identify /usr/local/bin/identify ➜ rails git:(aa) ✗ which convert /usr/local/bin/convert – Will May 15 '14 at 04:39
  • still getting the same error – Will May 15 '14 at 04:42
  • I've seen some people have issues with paperclip & cocaine versions. This might be the issue, but I don't have a custom geometry method which is where some people have traced the issue to – Will May 15 '14 at 05:37
  • 1
    At a command prompt are you able to successfully run `identify -format '%wx%h,1' ` where is some image file? That should be the command Paperclip is trying to run when you get the error and could help to know if it is ImageMagick giving you the problem or Paperclip/cocaine. –  May 15 '14 at 07:47
  • thanks @GraemeMcLean I tried that & updated the question with the results. – Will May 15 '14 at 21:17
  • 1
    That seems to suggest the problem is with ImageMagick rather with Paperclip. Unfortunately not being a mac user I probably can't help more. I did find one question here that might be of use - ignoring the accepted answer, the other two answers might be able to help you as they are talking about a similar problem. http://stackoverflow.com/questions/9586048/imagemagick-no-decode-delegate –  May 16 '14 at 13:52
  • 1
    @GraemeMcLean - thank you very much! that answer got me through, and the test to work out it was imagemagick not paperclip v helpful to know too. I hope you are having a wonderful weekend. – Will May 17 '14 at 05:26
  • When I received the libtool already installed message, I uninstalled it and then ran "brew install libtool --universal". After that, it worked. – Vince Oct 03 '14 at 23:24
  • I've researched some details in my case, hope would be of some use for you too http://stackoverflow.com/questions/37646471/imagemagick-brackets-in-file-names-no-such-file-or-directory-mac-os-x – aristofun Jun 05 '16 at 20:33

1 Answers1

1

I had the same issue and found it was a problem with homebrew and some packages which werent properly linked.

Run the command:

brew doctor

in your terminal for help debugging homebrew. I had this problem as well and it gave me the output

Warning: You have unlinked kegs in your Cellar

Follow the instructions in the debug output to link these

brew link "PACKAGE NAME"

In my instance it was libpng that was not properly linked.

Note: If you get an error "'DIRECTORY PATH' is not writable." run

sudo chown -R $(whoami) 'DIRECTORY PATH'

and try again

danbeggan
  • 105
  • 7