Tips for Installing ImageMagick & RMagick gem

by Irish on May 12, 2010

Installing RMagick on OS X has at times been really smooth for me, and other times, a royal pain in the ass. The issues usually come from having to get ImageMagick installed, but I’ve also had problems with the RMagick gem not being able to build the native extensions. I’ve successfully installed ImageMagick by using MacPorts and by compiling the sources by hand. Hopefully, some of these tips will help you with your installation if a problem occurs.

Tip #1: Keep MacPorts and your installed packages up to date!

MacPorts allows for easy installation of packages. But beware, MacPort’s packages are a bit of a dependency nightmare at times. If your installed packages are old and you use them to compile new packages, things can get messed up in the linking/compiling process, or simply just be completely incompatible. Be sure to run these commands often and always before you trying installing/upgrading anything.

$ sudo port selfupdate
$ sudo port upgrade outdated

Tip #2: MacPorts isn’t your only option

There are other’s out there that have felt the install pain. I came across this installer script that’s well maintained and as of this writing has been updated to work with ImageMagick-6.6.1-5

http://github.com/maddox/magick-installer/blob/master/magick-installer.sh

Simply grab it with Git

$ git clone http://github.com/maddox/magick-installer.git
$ cd magick-installer
$ ./magick-installer.sh

I’ve also heard good things about the OS X homebrew package management system, but have no personal experience in using it. Check it out here, and give it a go if it sounds up your alley.

http://mxcl.github.com/homebrew/

Tip #3: Ask for help

Check the Installation FAQS
They have solutions for some of the more common issues that tend to happen
http://rmagick.rubyforge.org/install-faq.html#loaderror

Search Online
Take any error messages you receive and try googling for answers to them. You can usually find blog posts from other people that have run into the same issues as you. Hit up the mailing lists or you can even send an email to the project maintainers at rmagick@rubyforge.org

Tip #4: Use the verbose flag when building the gem

This will show you what’s going on as far as the gem building making external requests for libs, what’s building/being written, and that can give you more details than just what the simple stacktrace will show you, when things go wrong.

$ sudo gem install rmagick -V

Tip #5: Be sure to test it after successful install

As noted on the RMagick site, the “Successfully installed” message does not mean that RMagick was successfully installed. The RMagick installation can encounter error conditions that gem can’t detect. The following irb session is a better indicator of a successful install.

$ irb -rubygems -r RMagick
irb(main):001:0> puts Magick::Long_version
This is RMagick 2.13.1 Copyright (C) 2009 by Timothy P. Hunter
Built with ImageMagick 6.6.1-5 2010-05-11 Q8 http://www.imagemagick.org
Built for ruby 1.8.7
Web page: http://rmagick.rubyforge.org
Email: rmagick@rubyforge.org
=> nil

{ 2 comments… read them below or add one }

Nicolai Dalsgaard July 8, 2010 at 5:14 am

Thanks… Tip #2 works perfect!

Reply

John Gorenfeld January 18, 2013 at 3:32 pm

Awesome. Thanks for this.

Reply

Leave a Comment

Previous post:

Next post: