LoginSignup
1
0

More than 5 years have passed since last update.

rmagickがbundle installできなかった時の対処法について

Posted at

 Railsでなぜかrmagickがインストールできなかった時の対処法

私の環境
Rails 4.2.5
ruby 2.3.1
Mac OS Sierra
imagemagick 6(7だと失敗するらしいです)

症状

tarminalでbundle installすると
tarminal.
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.

下記を見ると「MagickCore.pc」がないらしい。。。
Perhaps you should add the directory containing `MagickCore.pc'

なので「MagickCore.pc」を探すことに、、、

いろいろググっていると

gem install rmagickで失敗する。
https://qiita.com/KTakata/items/f4a632207af0a8078c06

が出てきました。ここにはパスを通して実行するとありました!

しかし。上記の記事では
MagickCore.pcの場所をあっさり見つけているのですが、私のPCにはない、、、
どうやって見つけたんだ、、、どうやらfindというものをターミナルで使うのか。
(私はプログラミングをを初めて1ヶ月ぐらいなので、、、それすら知りませんでした。みんな知っているのでしょうか)

なので、ターミナルで

tarminal.
$ find /uer/

と入力しいろいろ出てきた中からimagemagickで検索!
探して見ると

tarminal.
/usr/local//Cellar/imagemagick@6/6.9.9-40/lib/pkgconfig/MagickCore.pc

あった!

あとはさっきの
「gem install rmagickで失敗する。」
https://qiita.com/KTakata/items/f4a632207af0a8078c06
で見た$ PKG_CONFIG_PATH=を使ってパスを通してインストールしました。

tarminal.
$ PKG_CONFIG_PATH='/usr/local//Cellar/imagemagick@6/6.9.9-40/lib/pkgconfig/' gem install rmagick

って入れると
tarminal.
Building native extensions. This could take a while...
Successfully installed rmagick-2.16.0
Parsing documentation for rmagick-2.16.0
Installing ri documentation for rmagick-2.16.0
Done installing documentation for rmagick after 4 seconds
1 gem installed

できた!ということでした。

この記事がインストールの助けになれれば幸いです!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0