gem install rmagickでつまづいた件
Railsのプロジェクトを触っていて、画像解析をしたいと思って、ImageMagick & rmgickを使おうとしたときに躓いたところをメモしておきます。
bundle installでまず躓く
rmagickを使うにはまず、ImageMagickをbrewでインストールする必要があるのでそれがちゃんと入っているか確認。
よし!Gemfileにgem "rmagick"書き込んだし、bundle installを実行!
...あれ?エラった。ということでログを見てみます。
checking for clang... yes checking for Magick-config... yes checking for outdated ImageMagick version (<= 6.4.9)... no checking for Ruby version >= 1.8.5... yes checking for stdint.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.
ImageMagickのバージョンが6.4.9以上でないとダメみたい。
でもチェックしたところ、自分のMacに入っているバージョンは6.9.4-7なのでOKなはず。
いろいろ模索した結果
brew doctor
Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Run `brew link` on these: imagemagick
あれ?linkされてない?
とりあえずLinkしておくことに。
brew link imagemagick
その後
gem install rmagic Building native extensions. This could take a while... Successfully installed rmagick-2.15.4 Parsing documentation for rmagick-2.15.4 Installing ri documentation for rmagick-2.15.4 Done installing documentation for rmagick after 8 seconds 1 gem installed
ほぉお!できた。
有効にされてなかっただけだったとは。
こまめにbrew doctorはしないといけないなっておもいました。
この時もめっちゃWarningがでたので。