In getting the paperclip gem working on my server for some screenshots I ran into a frustrating problem. I kept getting an error during model saving: “/tmp/1234bduct-123.png is not recognized by the ‘identify’ command”. Eventually I solved the problem, so here is my solution, hoping that it helps someone else out there.
After some googling and reading Stack Overflow I quickly came across the solution that Paperclips :command_path option wasn’t being set correctly. The problem, however, was that it looked like I was correctly setting the ImageMagick path:
$ which identify /usr/local/bin/identify
I kept double- and triple-checking that the option was set correctly in my config/environments/staging.rb file:
WhazzingCom::Application.configure do .... Paperclip.options[:command_path] = "/usr/local/bin" end
That seemed to be correct, but I still kept getting the same error. Eventually I came across an excellent suggestion that perhaps my installed version of ImageMagick was incomplete, corrupt, or missing libs or dependencies. First I reran the ImageMagick apt-get install…
$ sudo apt-get install imagemagick --fix-missing
…which installed identify to /usr/bin rather than the existing version in /usr/local/bin. I then updated my environment file to the following…
WhazzingCom::Application.configure do .... Paperclip.options[:command_path] = "/usr/bin" end
…and refreshed the page and everthing worked as expected!