How do I install Image::Magick on mac os x?
Asked Answered
P

3

20

I've attempted installing with brew:

brew install imagemagick

The installation seems to have completed successfully. However, when attempting to:

use Image::Magick;

I get the following error message:

Can't locate Image/Magick.pm in @INC 

I don't know much about the perl system on a mac, or where brew might have installed Image::Magick (I'm told it should have installed the perl libraries as part of the imagemagick install).

Perish answered 4/6, 2013 at 19:46 Comment(2)
I guess you need to install the Perl bindings as well as ImageMagick itself. Not a Perl or a Homebrew user, but I would guess searching for perl-imagemagick or perl-magick in Homebrew.Beguin
I had to change all references in Makefile.PL from /usr/local to /opt/local, then run perl Makefile.PL, then make, then sudo make install.Accouter
C
18

AFAIK homebrew version of ImageMagick doesn't contain perl-magick. You should install it from the sources:

All the above is guessing - I'm using MacPorts. MacPorts has two ports: ImageMagick for the basic ImageMagick and p5-perlmagick for the perl bindings.

Counterirritant answered 4/6, 2013 at 20:24 Comment(1)
New for 2021: I had to download the version 7 tar file, not version 6. This way, the perlmagick version matches the version 7 version of imagemagick that homebrew now gives you.Triturable
T
0

On PerlMagick-6.89-1 there are 2 Errors and "make test" with

t/filter.t ........ Failed 1/58 subtests 

and

t/mpeg/read.t ..... Failed 2/2 subtests

Fix first see

http://www.imagemagick.org/discourse-server/viewtopic.php?t=29759

Second

the problem is

https://rt.cpan.org/Public/Bug/Display.html?id=102482

see code

t/mpeg/read.t there is a checksum problem

Testcode:

20 testRead( 'input.m2v',
21   'd0d08bbb6ea2f9d5d76bc134a4785f3ab25d6b03d66c64bc43b6b2a9174582d7' );
22 
23 #
24 # Motion Picture Experts Group file interchange format
25 #
26 ++$test;
27 testRead( 'input.mpg',
28   'bbffb8cfbd98a111f7ff625fbc2cf49485d92640de702a2e76c0852ead39c6f1' );

I think it's no serious problem or a very local.

Therefore in 99.9% off all cases a

sudo make install

is no problem.

Hopefully next time come a fix from PerlMagick Team.

Troubadour answered 15/7, 2016 at 13:24 Comment(0)
S
0

If someone have difficulties on apple silicon M3 installing Image::Magick. This is what I have done:

  1. brew install imagemagick

  2. go to http://www.imagemagick.org/download/perl/

  3. download http://www.imagemagick.org/download/perl/PerlMagick-7.1.1.tar.gz

  4. open Terminal.app

  5. cd ~/Downloads

  6. tar xvzf PerlMagick-7.1.1.tar.gz

  7. cd PerlMagick-7.1.1

  8. edit Makefile.PL and change /usr/local to /opt/homebrew

     # defaults for LIBS & INC & CCFLAGS params that we later pass to 
    
     Writemakefile
     my $INC_magick = '-I/opt/homebrew/include/ImageMagick-7 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libxml2 -I"' . $Config{'usrinc'} . '/ImageMagick-7"';
     my $LIBS_magick = '-L/opt/homebrew/lib -lMagickCore-7.Q16HDRI -lm -L' . $Config{'archlib'} . '/CORE';
     my $CCFLAGS_magick = "$Config{'ccflags'} -I/usr/include/freetype2 -g -O2 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16";
     my $LDFLAGS_magick   = "-L/opt/homebrew/lib -lMagickCore-7.Q16HDRI $Config{'ldflags'} ";
     my $LDDLFLAGS_magick = "-L/opt/homebrew/lib -lMagickCore-7.Q16HDRI $Config{'lddlflags'} ";
    

    ......

    'INSTALLBIN' => '/opt/homebrew/bin',
    

    ......

      $inherited =~ s:MAP_LINKCMD\s.*\s*\$\(CC\):MAP_LINKCMD   = \$(PERLMAINCC) -L/opt/homebrew/lib: ;
    
  9. perl Makefile.PL

  10. make

  11. make test

  12. make install (or sudo make install)

That is how it started working to me.

Sonya answered 29/3, 2024 at 11:29 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.