今回の環境: Mac OS X Yosemite


$ uname -mrsv
Darwin 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

gem コマンドで rmagick をインストールしようとしたら、 pkg-config がみつからないというエラーが発生 (必要な ImageMagick のバージョンが 6.4.9 以下って出力されてこれも何やらあやしい感じだけど・・・)。


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

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for xcrun... yes
checking for Magick-config... yes
checking for outdated ImageMagick version (<= 6.4.9)... no
/usr/local/bin/Magick-config: line 41: pkg-config: command not found
/usr/local/bin/Magick-config: line 47: pkg-config: command not found
/usr/local/bin/Magick-config: line 50: pkg-config: command not found
/usr/local/bin/Magick-config: line 53: pkg-config: command not found
checking for Ruby version >= 1.8.5... yes
/usr/local/bin/Magick-config: line 53: pkg-config: command not found
Can't install RMagick 2.15.0. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information.

*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/rmagick-2.15.0 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/rmagick-2.15.0/ext/RMagick/gem_make.out

ImageMagick は Homebrew でインストール済み。


$ brew install imagemagick
Warning: imagemagick-6.9.1-3 already installed

pkg-config が必要だと言われたので Homebrew で pkg-config をインストールする。


$ brew install pkg-config
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.28.yosemite.bo
######################################################################## 100.0%
==> Pouring pkg-config-0.28.yosemite.bottle.2.tar.gz
🍺  /usr/local/Cellar/pkg-config/0.28: 10 files, 612K

再度 rmagick のインストールに挑戦。


$ sudo gem install rmagick
Building native extensions.  This could take a while...
Successfully installed rmagick-2.15.0
Parsing documentation for rmagick-2.15.0
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/RMagick2.bundle, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rmagick.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rmdraw.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rmenum.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rmfill.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rmilist.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rmimage.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rminfo.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rmmain.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rmmontage.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rmpixel.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rmstruct.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/RMagick/rmutil.o, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/RMagick2.bundle, skipping
Installing ri documentation for rmagick-2.15.0
1 gem installed

今度はうまくインストールできた(^_^)v

tags: imagemagick rmagick mac_os_x ruby

Posted by NI-Lab. (@nilab)