Can't install RMagick 2.13.1. Can't find MagickWand.h.

When I try do install rmagick I get the following error message:

Can't install RMagick 2.13.1. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

I'm on Mac OSX 10.6.8, ruby 1.9.2p290, rvm 1.10.2.

Can anyone help me please to solve this problem.


If you're on Ubuntu, installing this package is what fixed it for me:

sudo apt-get install libmagickwand-dev

It looks like ImageMagick 7 changed include file path.

On building rmagick, since it includes file as wand/MagickWand.h There are no workarounds. It looks like sticking with ImageMagick 6 for now.

On Mac OS X (I tested on Sierra), I used HomeBrew's versions tap like:

brew tap homebrew/versions
brew install imagemagick@6

Then, use the path shown on above installation:

PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick

To install with ImageMagick 6.


I didn't want to mess with environment variables since I wanted bundler to be able to compile this gem on its own on a CI machine. Instead, I used Homebrew to install pkg-config:

brew install pkgconfig

and the next time I tried compiling the RMagick gem it found the header file without issue.

(This is pkg-config 0.28, ImageMagick 6.8.0-10, and RMagick 2.13.2, all on Mountain Lion.)