Old Guy New Trick

An old guys journey to learn how to code.

Brew A Fix for Imagemagic and Paperclip

Author: John on October 27, 2014

While working on a Rails project last week I encountered an issue where some of my tests were failing.  It had been a while since I worked on this project so I had to re-familiarize myself with what was going on.

The tests were failing when editing a profile and adding an image.  I popped over to the browser and performed a manual test to get a better idea of what was going on.  That is when I saw the following error: "Paperclip::Errors::NotIdentifiedByImageMagickError"

To attempt to fix the issue, I first performed a simple uninstall and re-install of imagemagic using Homebrew:

brew uninstall imagemagick
brew install imagemagick

This didn't solve the problem.  Imagemagic has a command line utility, convert, which one can use to see if the application is working.  I tried a simple test:

convert moonie.jpg moon.png

But I continued to get errors even with that simple test.  So off to the internet for some deep research.  I came across the following steps, which solved the issue I was having.

brew update
brew doctor
brew uninstall libtool
brew uninstall imagemagic

cd /Library/Caches/Homebrew
rm imagemag*
rm libtool-2.4.2.tar.gz

brew doctor
brew install libtool --universal
brew link libool --force
brew install imagemagic --build-from-source

After completing the above steps, the command line tool, convert was successful.  I re-tested the Rails application, both manually, and via my test suite, and all was green again.

Related resources used during my quest for the fix:

Learn Something New Every Day

Last Edited by: John on November 11, 2015