うちのいぬ Tech Blog

Tech Blog of Uchinoinu/My dog

Macでbrew updateしたら、rails s すると以下のエラーが出るようになった時、 brew info と brew switchで乗り切る

この間 brew update したら ImageMagickのバージョンがあがってしまい、RMagickが動かなくなりました。

 

$ rails s
=> Booting Puma
=> Rails 4.2.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/Users/hoge/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require': This installation of RMagick was configured with ImageMagick 6.9.0 but ImageMagick 6.9.2-10 is in use. (RuntimeError)

ほんとなんてこったいですな。

ちょっと前ならhomebrew-boneyard入れてbrew versions imagemagickと叩いて色々してくと、サササっと解決できたのですが、今はこれも過去のツール。動きません。

いまだとhomebrew-versionsを使うとそれっぽい解決が出来ますが、今回はもっと単純に済みました。

$ brew info imagemagick

$ brew info imagemagick
imagemagick: stable 6.9.2-10 (bottled), HEAD
Tools and libraries to manipulate images in many formats
http://www.imagemagick.org
/usr/local/Cellar/imagemagick/6.9.0-9 (1442 files, 22M)
Poured from bottle
/usr/local/Cellar/imagemagick/6.9.2-10 (1453 files, 22M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/imagemagick.rb
==> Dependencies
Build: xz ✔, pkg-config ✔
Required: xz ✔, libtool ✔
Recommended: jpeg ✔, libpng ✔, libtiff ✔, freetype ✔
Optional: fontconfig ✘, little-cms ✘, little-cms2 ✘, libwmf ✘, librsvg ✘, liblqr ✘, openexr ✘, ghostscript ✘, webp ✘, fftw ✘, pango ✘
==> Options
--with-fftw
.
.
.

6.9.0-9と6.9.2-10がインストールされているのがわかります。 現在は後者が使用されているので、これを切り替えます。

$ brew switch imagemagick 6.9.0-9

Cleaning /usr/local/Cellar/imagemagick/6.9.0-9
Cleaning /usr/local/Cellar/imagemagick/6.9.2-10
71 links created for /usr/local/Cellar/imagemagick/6.9.0-9
$ brew info

.
.
/usr/local/Cellar/imagemagick/6.9.0-9 (1442 files, 22M) *
Poured from bottle
/usr/local/Cellar/imagemagick/6.9.2-10 (1453 files, 22M)
Poured from bottle

切り替わってるのがわかるかと思います。

これで乗り切れました。