Installing RMagick in Mac OS X Mountain Lion / Maverick with Homebrew

January 28, 2013

Installing RMagick with homebrew should be trivial, but it’s not. For some reason the last version of RMagick (2.13.1) does not compile with the last version of ImageMagick (6.8.2-0).

If you install the last version of ImageMagick with homebrew it will work without problems but the RMagick extension will fail during the build with the following error:

checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... yes
checking for InitializeMagick() in -lMagickCore... no
checking for InitializeMagick() in -lMagick... no
checking for InitializeMagick() in -lMagick++... no
Can't install RMagick 2.13.1. Can't find the ImageMagick library or one
of the dependent libraries. Check the mkmf.log file for more detailed

I’m not sure but I think there are some compatibility problems with the new versions of ImageMagick and RMagick. One version I know works well is 6.6.7-0 let’s install it using homebrew.

If you already have ImageMagick installed uninstall it before continue.

$ brew uninstall imagemagick

Now let’s edit the brew formula.

$ brew edit imagemagick

You should set the url to and comment the sha256 line.

class Imagemagick < Formula
  homepage ''

  # upstream's stable tarballs tend to disappear, so we provide our own mirror
  # Tarball from:
  # SHA-256 from:
  # Remove this url
  # url ''
  # Add this new url
  url ''

  # Comment this line
  # sha256 'b3dfcb44300f73e73ffa8deef8bba4cf43f03d7150bf1fd0febedceac1a45c7e'

  head '',
    :using => UnsafeSubversionDownloadStrategy


After saving the file you can install ImageMagick. You should also disable openmp and build it from source.

$ brew install imagemagick --disable-openmp --build-from-source

Now the RMagick installation should work like a charm!

$ gem install rmagick

comments powered by Disqus