読者です 読者をやめる 読者になる 読者になる

ざっくりん雑記

プログラミングで忘れそうなことをひたすらメモる

Macでrmagickのbundle installに失敗したときの対処

Rails 備忘録

エラー内容

Installing rmagick 2.15.4 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/azunobu/.rbenv/***/rmagick-2.15.4/ext/RMagick
/Users/azunobu/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20160704-56813-17nbb4t.rb extconf.rb
checking for clang... yes
checking for Magick-config... no
checking for pkg-config... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
checking for outdated ImageMagick version (<= 6.4.9)... *** 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/azunobu/.rbenv/versions/2.3.0/bin/$(RUBY_BASE_NAME)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/azunobu/.rbenv/***/rmagick-2.15.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/azunobu/.rbenv/***/gems/rmagick-2.15.4 for inspection.
Results logged to /Users/azunobu/.rbenv/***/rmagick-2.15.4/gem_make.out

解決方法

  1. $ brew install imagemagick
  2. $ bundle install
  3. Bundle complete!

参考

stackoverflow.com