Configuring ImageMagick and RMagick to play nice

Using homebrew on OSX Mavericks

Thomas V.

2 minute read

Sometimes it takes a little work to get ruby gems and homebrew installs working properly on your Mac.

The error message below shows that bundler is having trouble finding the MagickWand.h header file.

pkg-config is a super useful helper tool that will help ruby gems find installed libraries.

19:11:06 $ thomas@bear arthouse (master): bundle install
Fetching source index from https://rubygems.org/
Installing rmagick (2.13.2)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/thomas/.rbenv/versions/2.0.0-p353/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for clang... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
/usr/local/bin/Magick-config: line 41: pkg-config: command not found
/usr/local/bin/Magick-config: line 47: pkg-config: command not found
/usr/local/bin/Magick-config: line 50: pkg-config: command not found
/usr/local/bin/Magick-config: line 53: pkg-config: command not found
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no

Can't install RMagick 2.13.2. 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.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=/include
	--with-opt-lib
	--without-opt-lib=/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/thomas/.rbenv/versions/2.0.0-p353/bin/ruby


Gem files will remain installed in /Users/thomas/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rmagick-2.13.2 for inspection.
Results logged to /Users/thomas/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0/gems/rmagick-2.13.2/ext/RMagick/gem_make.out

An error occurred while installing rmagick (2.13.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.

After installing, reinstall imagemagick and run brew link and you’ll be good to go:

$ brew install pkgconfig
$ brew uninstall imagemagick
$ brew install imagemagick
$ brew link imagemagick
$ bundle install
comments powered by Disqus