18

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.

Mark
  • 6,112
  • 4
  • 21
  • 46

10 Answers10

26

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.

Trip
  • 323
  • 2
  • 10
  • I ended up just downgrading to image magik 6 to save myself the headaches but it appears your fix is a better solution, thanks. – Mark Apr 19 '17 at 12:40
  • 1
    `brew unlink pkgconfig && brew link pkgconfig` got the job done for me. – Beer Me Feb 06 '18 at 16:52
  • That's why containers are awesome Docker – Abdennour TOUMI Oct 24 '18 at 13:27
  • I'm getting "Error: imagemagick: Unsupported special dependency :perl" – Gal Bracha Apr 24 '19 at 09:12
  • 1
    To fix "Error: imagemagick: Unsupported special dependency :perl" I've created one that fixes the issue and remove the optional perl dependency - `brew install https://gist.githubusercontent.com/rootux/12cf343688b4ac28b2e9ae5f06827856/raw/3b678d601bef0902cb7ff6d9cc01b86dfd1f7932/imagemagick.rb` – Gal Bracha Apr 24 '19 at 09:22
  • Another thing that eventually worked for me - uninstall and reinstall `pkg-config` bvy doing `brew unlink pkg-config && brew reinstall pkg-config` – Gal Bracha Apr 24 '19 at 09:38
19

Worked this one for me at osx sierra

brew unlink imagemagick
brew install imagemagick@6 && brew link imagemagick@6 --force
echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.bash_profile

Got it here RMagick installation: Can't find MagickWand.h

Community
  • 1
  • 1
12

Imagemagick 7 seems to not cooperate. Here is what I have found, it works for me:

brew update
brew rm imagemagick
brew install imagemagick@6
brew link imagemagick@6 --force
bundle

If you do not want to force link you can also do the following:

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

per @Leo's comment

Please look at this GitHub Issue for more details.

tnaught
  • 301
  • 4
  • 13
  • 2
    confirmed fix for osx 10.12.6 ruby 2.3.1 rails 5 – dc10 Aug 11 '17 at 23:01
  • 1
    Another solution from that GitHub issue page, if you don't want to force link: `brew install imagemagick@6` then `PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick` – Leo Sep 12 '18 at 17:14
2

I had a similar issue with running

$ gem install rmagick

First of all, do you have imagemagick installed? If you're not sure, run

$ convert --version

If you do, you probably either installed it with fink or macports (maybe homebrew?). What is happening is that rvm can't find the imagemagick directory.

After reading https://superuser.com/questions/361435/i-have-compiled-imagemagick-on-my-centos-and-rmagick-wont-install I exported the imagemagick path by adding

$ export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"

to my ~/.bash_profile, sourcing the new profile, then running gem install rmagick again.

It worked for me after I did this.

Community
  • 1
  • 1
Mayur Shah
  • 3,344
  • 1
  • 22
  • 41
  • I found this http://serverfault.com/questions/484850/installing-imagick-php-extension-on-centos-6-3-64bit – Mayur Shah Feb 15 '17 at 16:08
  • I was able to fix it eventually by uninstallign imagemagick 7.bla and reinstalling version 6, seemed to fix my issue, thanks again for taking the time to answer. – Mark Feb 15 '17 at 16:41
  • He copied this answer from another SO question. – Rigo Mar 15 '17 at 15:58
2

Got same error for alpine 3.9 image build. It comes with ImageMagick 7.0.8.38-r0

To fix that you either use alpine 3.5 with ImageMagick 6.9.6.8-r1:

FROM alpine:3.5

Or install ImageMagick 6.9.6.8-r1 with package repository for 3.5:

RUN apk add imagemagick-dev=6.9.6.8-r1 --repository http://dl-3.alpinelinux.org/alpine/v3.5/main/

There is an open issue in rmagick repo regarding failed builds for ImageMagick 7.0.x. so hopefully it will be fixed soon.

Martin
  • 4,042
  • 2
  • 19
  • 29
1

This works for me:

    $ brew unlink imagemagick
    $ brew install imagemagick@6 && brew link imagemagick@6 --force
    $ echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc
    $ bundle install
rld
  • 2,603
  • 2
  • 25
  • 39
0

After much trial and error it appears the issue is ImageMagick 7 not playing nicely with OS Sierra. I downgraded to 6 and now works fine.

Mark
  • 6,112
  • 4
  • 21
  • 46
0

Here is what worked for me (This is a special imagemagick without perl dependency)

$ brew unlink pkg-config && brew reinstall pkg-config
$ brew uninstall imagemagick
$ brew install https://gist.githubusercontent.com/rootux/12cf343688b4ac28b2e9ae5f06827856/raw/3b678d601bef0902cb7ff6d9cc01b86dfd1f7932/imagemagick.rb

I was getting "Error: imagemagick: Unsupported special dependency :perl" and had issues with pkg-config

Gal Bracha
  • 19,004
  • 11
  • 72
  • 86
0

Is this really still a problem, now that ImageMagick 7.x is several years old? Apparently it still is, as software such as Debian and people who are insane enough to still target that crap are still developing for ImageMagick 6.x.

You're really better off updating your software to work with ImageMagick 7, rather than sticking with old versions forever.

kode54
  • 61
  • 2
0

For macOS Monterey on Macbook Pro M1 chip

try:

brew install imagemagick@6 && brew link imagemagick@6 --force
echo 'export PATH="/opt/homebrew/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc
saberprashant
  • 388
  • 5
  • 15