How to clean up ImageMagick Install in a Rails app with Paperclip?

March 28, 2015 1.6k views
Ruby on Rails Nginx

I've had a problem with ImageMagick in my Rails application. It will upload GIF's but not other image type. I searched for ImageMagick and it seems like I have multiple versions installed. I installed version 6.9.0 from source but it appears that an earlier version was installed. Can someone tell me if this looks right? If it isn't how to I fix it?

find / -name ImageMagick

Can I just delete "/usr/local/lib/ImageMagick-6.9.0" to fix my problem? How can I do a clean install?

Also, when I run which convert, I get the following.

which convert

3 Answers

Fixed the Paperclip load path in my production.rb environments file (/usr/bin/) and that solved my image upload problem.

I have a question related with this, my question is what did you put in config/environment.rb file.

Because i know that i have to put Paperclip.options[:command_path] = "/usr/bin/" in both development.rb and production.rb

But the instructions say that we have to put something in config/environment.rb file and i don't know what is that.

  • I have fixed my problem, i forgot to run bundle install then put Paperclip.options[:command_path] = "/usr/bin/" in /config/environment/development.rb and that fix my problem so the steps that i used was from the beginning:

    1. sudo apt-get install imagemagick
    2. which convert to see where is installed imageMagick this get something like /usr/bin/convert
    3. add Paperclip.options[:command_path] = "/usr/bin/" to /config/environment/development.rb
    4. Add gem 'paperclip', '~> 4.3' in my Gemfile
    5. Run bundle install
    6. Run rails g paperclip project image to add paperclip image to my project

This is what my production.rb file looks like:

Paperclip.options[:commandpath] = "/usr/bin/"
LIBRARY_PATH = "/usr/bin/"

My development.rb file looks like:

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

Have another answer? Share your knowledge.