Recipe: Installing ImageMagick Perl Bindings on Mac OSX

Ideally, one would expect that this works the orthodox way using MacPorts:

$ port install ImageMagick
$ port install p5-perlmagick

The first problem here is ImageMagick itself, as it depends on xorg-libX11 and that expects xproto which I do not have. And do not care to have.

Luckily the port supports variants:

$ port info ImageMagick
ImageMagick @6.5.1-0 (graphics, devel)
Variants:    darwin_6, graphviz, ..., no_x11, perl, ....

So if you do not care about display images with ImageMagick, then you can suppress building of X11 specific parts:

$ port install ImageMagick +no_x11

Now I thought that a followup

$ port install p5-perlmagick

will add Perl binding support, but instead I was confronted with pretty unfriendly checksum problems:

Error: Checksum (md5) mismatch for PerlMagick-6.32.tar.gz
Portfile checksum: PerlMagick-6.32.tar.gz md5 a341de8299859630ca82b74ee7173204
Distfile checksum: PerlMagick-6.32.tar.gz md5 6b6e7ee0cdda9610e97e2ffa281a780b
Error: Target org.macports.checksum returned: Unable to verify file checksums

That looks pretty suspicious as I am not the only one to report this. What is equally suspicious is that the port has version 6.32

$ port info p5-perlmagick
p5-perlmagick @6.32 (perl)

and the latest version on CPAN is 6.40. What is even more suspicious is that that is marked as UNAUTHORIZED RELEASE , there are no earlier versions unless you go to the Backpan, and even then there is a version gap.

Anyway, the installation via cpan also fails

$ cpan
cpan[1]> install Image::Magick
# lots of compilation warnings and errors
# ... error: too few arguments ...

indicating that there is a version mismatch between what the current ImageMagick offers and what the Perl bindings expect.

But then I noticed that the MacPorts port also has a Perl variant:

$ port install ImageMagick +no_x11 +perl

And voila, the bindings are there. Once I had found my own solution, it was easy to find it with Google (inside the comments).

So much about post-mortem search engines.

Posted In

port install ImageMagick +no_x11 +perl for MAC OS X

When I do this, and I try to write a Perl script with:
use Image::Magick;

I just get told that:

Can't locate Image/ in @INC (@INC contains: /Library/Perl/Updates/5.8.8/darwin-thread-multi-2level /Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at ./ line 2.

When I type:
perl -e "print join(\"\n\", @INC);"

The output is:

Which I notice these paths are not mentioned on the initial @INC fail.

How do I get my Perl install to find the Image::Magick module? I've spent 3 full days on just this one issue (I'm not unix Guru)

jtromans (not verified) | Sun, 01/16/2011 - 14:30

Re: port install ImageMagick

I'm not unix Guru

But you now see that it pays off to become one! :-)

I see two options:

  • run "port" in a more verbose mode, so that it will show you where it puts the libraries.
  • use "find" to find (sic!) after the installation:
find / -iname ''

And then rearrange your PERLLIB environment variable.


rho | Tue, 01/18/2011 - 09:39