Can't find MagickWand.h
While trying to initialize a project into a new gemset with bundler, I ran into trouble installing RMagick. It’s not the first time this has happened.
$ bundle
...
Installing rmagick (2.13.1) with native extensions /Users/brian/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/installer.rb:533:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/brian/.rvm/rubies/ruby-1.8.7-p352/bin/ruby extconf.rb --with-opt-include=/usr/local/include
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
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... no
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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/brian/.rvm/rubies/ruby-1.8.7-p352/bin/ruby
Gem files will remain installed in /Users/brian/.rvm/gems/ruby-1.8.7-p352@wg/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/brian/.rvm/gems/ruby-1.8.7-p352@wg/gems/rmagick-2.13.1/ext/RMagick/gem_make.outI knew that I had MagickWand.h:
$ mdfind MagickWand.h /usr/local/include/ImageMagick/wand/MagickWand.h
Trying to set the configuration options was not helpful. Finally, I read the mkmf.log which said that one of the include paths was $MAGICK_HOME/include/ImageMagick.
The fix was to set the MAGICK_HOME variable before the bundle install:
$ MAGICK_HOME=/usr/local bundle
-
James — November 2, 2011
Hi, I’m trying to use your approach, but I’m not sure how to do the last step. In which file do I set the MAGICK_HOME?
-
Brian Hempel — November 2, 2011
MAGICK_HOME is a shell variable, so you set it in the terminal—not any particular file. At the end of the post, I set it just before running the `bundle` command. You can also set it in a separate command by running:
$ export MAGICK_HOME=path_here
Let me know if you have any other questions.
-
James — November 2, 2011
Ah yes, I realized this shortly after posting my comment. Oops.
My problem is different though. I’m now noticing that the installation can’t even find stdint.h or types.h Any ideas? I know the files are there, it just seems like setting MAGICK_HOME doesn’t work for me. :|
checking for Ruby version >= 1.8.5… yes
checking for /usr/bin/gcc… yes
checking for Magick-config… yes
checking for ImageMagick version >= 6.3.5… yes
checking for HDRI disabled version of ImageMagick… yes
checking for stdint.h… no
checking for sys/types.h… no
checking for wand/MagickWand.h… no -
James — November 2, 2011
It worked just now! No idea why! LOL Thanks of your post.
-
Rob — January 4, 2012
This worked for me:
C_INCLUDE_PATH=/opt/local/include/ImageMagick/ gem install rmagick
-
Jay — March 30, 2012
@Rob
You are a star and you know it! :-)
Worked like clock work
C_INCLUDE_PATH=/usr/local/include/ImageMagick/ gem install rmagick -
Ted — May 14, 2012
Thanks so much! The following worked for me also
C_INCLUDE_PATH=/usr/local/include/ImageMagick/ gem install rmagick
