22 January 2017

gem install rmagick on ubuntu

Installing gem rmagick on ubuntu is almost worse than installing mysql gems used to be!


You will get a variety of errors depending on the version of ubuntu, the version of imagemagick, the various imagemagick libraries, and the version of rmagick you have installed or want to install. I mostly suffered from "checking for wand/MagickWand.h... no", "Can't install RMagick 0.0.0." (dunno where the version number went), "*** extconf.rb failed ***", among others.


This is what finally worked for me:
  • fresh install of Ubuntu 14.04
  • sudo apt-get -y install libmagickcore5 libmagickwand-dev libmagickwand5 ruby-rmagick graphicsmagick graphicsmagick-dbg  imagemagick imagemagick-common libmagick++-dev libmagick++5 libmagickcore-dev libmagickcore5 libmagickcore5-extra libmagickwand-dev libmagickwand5
  • gem install rmagick

(at time of writing, "gem install rmagick" installs 2.16.0 without complaint)



Ubuntu 14.04 supports imagemagick 6.7.7-10 and no later version. Ubuntu 16.04, on the other hand, doesn't offer anything earlier than 6.9.


According to tellnes, newer versions of imagemagick will not work with rmagick, although the rmagick page says: "Version 6.4.9 or later")



I didn't take the trouble to try the apt packages one-by-one to figure out the minimal set of packages rmagick needs to install successfully.



Note, "this works for me" ... it probably won't work for you. Google can point you to a large number of absolutely sure fixes for this problem, all of which worked for their authors, and none of which worked for me.