RMagick installation: Can't find MagickWand.h Ask Question

RMagick installation: Can't find MagickWand.h Ask Question

Updating RMagick and Imagemagick is a painful expierence. I have updated the Imagemagick version on my mac (MacOS El Capitan Version 10.11.5) with homebrew for one project in Ruby 2.3 to 6.9.5-9

$ convert --version
Version: ImageMagick 6.9.5-9 Q16 x86_64 2016-09-09

Now an older project in Ruby 1.8.7 refuses to work with the error message "this installation of RMagick was configured with ImageMagick 6.8.9 but ImageMagick 6.9.5-9 is in use". Thus I uninstalled "rmagick", but it can not be installed again

$ gem install rmagick -v 2.16.0
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
ERROR: Failed to build gem native extension.

checking for /usr/local/opt/gcc46/bin/gcc-4.6... yes
checking for Magick-config... yes
checking for outdated ImageMagick version (<= 6.4.9)... no
checking for presence of MagickWand API (ImageMagick version >= 6.9.0)... no
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for wand/MagickWand.h... no

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

And if it can not be installed, the whole application can not be started. I tried all the answers from here, and none of them works on MacOS :-( I reinstalled imagemagick and pkg-config with homebrew, and tried various version of RMagick without success. 2.16.0 is the latest version of RMagick currently.

MagicWand は ImageMagick バージョン 6.9 以上で使用されているようで、次のマシンで見つかります:

find /usr/local -name MagickWand.h
=> /usr/local/Cellar/imagemagick/6.9.5-9_1/include/ImageMagick-6/wand/MagickWand.h

find /usr/local -name MagickWand.pc
=> /usr/local/Cellar/imagemagick/6.9.5-9_1/lib/pkgconfig/MagickCore.pc

gem のインストール中にこれらのパスを指定しても動作しません (上記と同じエラー) :-(

C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.9.5-9_1/include/ImageMagick-6 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig gem install rmagick

アップデート:

このエラーは Ruby 1.8.7 でのみ発生します。Ruby 2.0 および Ruby 2.3 用の RMagick をインストールすることは可能です。Ruby 1.8.7 と ImageMagick 6.9.5 は互換性がないようです。

  • ルビー 1.8.7 x
  • ルビー 2.0.0 ✓
  • ルビー 2.3.1 ✓

ベストアンサー1

この問題を解決するにはMac OSX Sierra、High Sierra、El Capitan、Mojave、Catalina、Big Sur、Monterey (M1 チップ)、次の操作を実行できます。

brew unlink imagemagick
brew install imagemagick@6 && brew link imagemagick@6 --force

imagemagick@6なのでkeg-only、強制的にリンクする必要があります。

おすすめ記事