事象
MacでRailsの環境構築中にRMagick 2.16.0のinstallで失敗する
環境
Mac : sierra
Ruby: 2.3.1
ImageMagick : 7.0.5
errorログ
$ bundle install --path vendor/bundle
・
・
・
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /rails_apps/vendor/bundle/ruby/2.3.0/gems/rmagick-2.16.0/ext/RMagick
/Users/myuser/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170417-561-1rfccuu.rb extconf.rb
checking for clang... yes
checking for Magick-config... no
checking for pkg-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... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no
Can't install RMagick 2.16.0. 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/myuser/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME)
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/rails_apps/vendor/bundle/ruby/2.3.0/extensions/x86_64-darwin-16/2.3.0-static/rmagick-2.16.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /rails_apps
/vendor/bundle/ruby/2.3.0/gems/rmagick-2.16.0 for inspection.
Results logged to /rails_apps
/rails_apps/vendor/bundle/ruby/2.3.0/extensions/x86_64-darwin-16/2.3.0-static/rmagick-2.16.0/gem_make.out
An error occurred while installing rmagick (2.16.0), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.16.0'` succeeds before bundling.
原因
ImageMagick version >= 6.9.0)... no
これが、マズい。
imagemagickが最新のhomebrewでは、7系がはいってしまうので、
対応
imagemagickをuninstallして
6系を遡ってbrew installしてあげればOK
$ brew uninstall imagemagick
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/6f014f2b7f1f9e618fd5c0ae9c93befea671f8be/Formula/imagemagick.rb
Updating Homebrew...
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/imagemagick-6.9.7-3.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring imagemagick-6.9.7-3.sierra.bottle.tar.gz