Installing ImageMagick on FreeBSD with a non-system Perl

As of the time of writing (December 2009), the current version of PerlMagick on CPAN doesn't work with the current port of ImageMagick on FreeBSD.

To install ImageMagick with a non-system Perl on FreeBSD

  1. As root, install ImageMagick from ports:
    cd /usr/ports/graphics/ImageMagick
    make install
  2. Copy the PerlMagick directory in the build:
    mkdir ~/PerlMagick
    cp -r /usr/ports/graphics/ImageMagick/work/ImageMagick-6.5.5-10/PerlMagick ~/PerlMagick
  3. Edit "Makefile.PL" to add the correct include and library directories:
    $ diff Makefile.PL Makefile.PL.~1~ 
    <    'INC'	=> '-I/usr/local/include/ImageMagick -I../ -I.. -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/libxml2',
    >    'INC'	=> '-I../ -I.. -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/libxml2',
    <    'LIBS' => [ '-L/usr/local/lib -L../magick/.libs -lMagickCore -L../wand/.libs -lMagickWand -lperl -lm' ],
    >    'LIBS' => [ '-L../magick/.libs -lMagickCore -L../wand/.libs -lMagickWand -lperl -lm' ],
  4. Do
    perl Makefile.PL
    make install
    The compilation creates a lot of warnings.

Copyright © Ben Bullock 2009-2022. All rights reserved. For comments, questions, and corrections, please email Ben Bullock ( or use the discussion group at Google Groups. / Privacy / Disclaimer