无法安装 RMagick 2.15.4。找不到 MagickWand.h

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

当我尝试安装 rmagic 时,它显示以下错误

ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

/Users/***/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20170814-
44982-1i5w4mc.rb extconf.rb
checking for gcc... yes
checking for Magick-config... no
checking for pkg-config... yes
checking for outdated ImageMagick version (<= 6.4.9)... no
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no

Can't install RMagick 2.15.4. 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.

我正在使用 MacOS sierra,ruby 版本 2.2.3

我不久前遇到过这个问题。你需要安装 imagemagick。根据 rmagic gem

的 github 回购协议

Pre-reqs:

ImageMagick Version 6.4.9 or later. You can get ImageMagick from www.imagemagick.org.

相信你也可以用brew来安装

$ brew install imagemagick@6
$ brew link imagemagick@6 --force
$ gem install rmagick
brew unlink pkgconfig
bundle install
brew link pkgconfig

对我有用