Search code examples
ruby-on-railsrmagickmagickwand

Rails - Can't install RMagick 2.16.0. Can't find MagickWand.h


I appreciate this question has been asked many times before, however I've tried all available answers to no avail. The error log is as follows:

have_header: checking for wand/MagickWand.h... -------------------- no

"gcc -E -I/Users/mark/.rvm/rubies/ruby-2.3.3/include/ruby-2.3.0/x86_64-darwin16 -I/Users/mark/.rvm/rubies/ruby-2.3.3/include/ruby-2.3.0/ruby/backward -I/Users/mark/.rvm/rubies/ruby-2.3.3/include/ruby-2.3.0 -I.  -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/Cellar/imagemagick/7.0.4-8/include/ImageMagick-7  -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/Cellar/imagemagick/7.0.4-8/include/ImageMagick-7  conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'wand/MagickWand.h' file not found
#include <wand/MagickWand.h>
     ^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <wand/MagickWand.h>
/* end */

After running mdfind MagickWand.h I can see the path is:

/usr/local/Cellar/imagemagick/7.0.4-8/include/ImageMagick-7/MagickWand/MagickWand.h

I then run:

C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/7.0.4-8/include/ImageMagick-7/MagickWand/ gem install rmagick

However get the same message as before.

Any help for how to get this solved is greatly appreciated.


Solution

  • I have had the same issue for about a month, Mark (ever since the Imagemagick 7 update). I'm using homebrew on OSX Sierra.

    For future visitors to this question, you can try linking and unlinking pkgconfig (brew unlink pkgconfig && brew link pkgconfig) or specifying the path as Mayur describes, but if those don't work you'll need to install Imagemagick 6 from source as Mark has done:

    $ brew uninstall imagemagick
    $ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/6f014f2b7f1f9e618fd5c0ae9c93befea671f8be/Formula/imagemagick.rb
    

    I believe the issue ultimately lies with pkgconfig, so when you see an update to pkgconfig, that should be the tipoff to try again.