ImageMagick 7 with RMagick 2.16 on MacOS Sierra Can't find MagickWand.h

10,565

Solution 1

I have just encountered and solved this issue on a new Mac running Sierra. There seems to be no solution for ImageMagick 7 at this time.

  1. Uninstall existing imagemagick if needed

  2. Install version 6:

    brew install imagemagick@6

  3. Since this is keg-only, you should then force-link it:

    brew link --force imagemagick@6

This installed imagemagick version 6.9.7-4 for me.

Afterwards, the gem then installed successfully. I am including the version numbers for future readers:

Installing rmagick 2.13.4 with native extensions

Solution 2

dyson's solution didn't quite work for me. I found that in addition to installing imagemagick@6, I also need to install pkg-config and then set PKG_CONFIG_PATH.

brew install imagemagick@6 pkg-config
PATH="/usr/local/opt/imagemagick@6/bin:$PATH" PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick -v '2.13.4'
Share:
10,565
florigee
Author by

florigee

ruby on rails lover, interested in ember, fancy stuff and my awesome wife. Running my own company in augsburg, bavaria.

Updated on June 02, 2022

Comments

  • florigee
    florigee almost 2 years

    I upgraded to imagemagick-7.0.4-3.sierra and now my previously installed RMagck 2.16 fails. I checked for MagicWand:

    $ find /usr/local -name MagickWand.h /usr/local/Cellar/imagemagick/7.0.4-3/include/ImageMagick-7/MagickWand/MagickWand.h

    So it seems to be there. Also I reinstalled and relinked pgk-config. Didn't help as well. Any ideas?

  • mmln
    mmln over 7 years
    I didnt find a solution for making rmagick to work with imagemagick v7, falling back to v6 works as described in this answer, thanks
  • maxhm10
    maxhm10 over 7 years
    You saved me so much frustration. Thank you!!
  • Brian
    Brian about 7 years
    I found this 2 hours in. I want to throw my computer out a window.
  • Daniel
    Daniel about 7 years
    I opened an issue: github.com/rmagick/rmagick/issues/265 Let's see if they add this to the documentation.
  • dyson returns
    dyson returns about 7 years
    Thanks @Daniel. You're a champ.
  • Yunwei.W
    Yunwei.W almost 7 years
    had to run echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.bash_profile after the above steps. hope it helps others.
  • dyson returns
    dyson returns almost 7 years
    @Yunwei.W Are you sure you uninstalled other versions of imagemagick and that you definitely force-linked it?
  • utahtwo
    utahtwo almost 7 years
    Thank you! Worked great on Sierra
  • caleb531
    caleb531 over 6 years
    If you'd prefer not to load all of ImageMagick's binaries onto your PATH, you can also run export PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig
  • Peter H. Boling
    Peter H. Boling about 6 years
    I needed both --force AND --overwrite: brew link --force --overwrite imagemagick@6 Otherwise this worked!
  • Valdis
    Valdis over 5 years
    I prefer this solution because I don't have to remove the global linking to the latest ImageMagick version.
  • Rafał Cieślak
    Rafał Cieślak about 5 years
    @TheLazyLog I think the problem with other solutions is that they assume you have stuff like pkg-config installed – after some time of using homebrew, one will definitely wind up with pkg-config on their computer. I was setting up a fresh Mac so that assumption just wasn't true for me.