Installing our beloved Imager on macOS Sonoma with support for PNG, JPEG and GIF involves some pain. Here are the results of my struggle so others won't have to. Do this after installing Imager (requires Homebrew):
brew install pkg-config

brew install libpng
pkg-config --cflags libpng
cpan Imager::File::PNG

brew install jpeg
pkg-config --cflags libjpeg
cpan Imager::File::JPEG

brew install giflib
cpan Imager::File::GIF

GIF: Test code failed: Can't link/include 'gif_lib.h', 'stdio.h', 'errno.h', 'string.h', 'gif'...
! Configure failed for Imager-File-GIF-0.98. See /Users/you/.cpanm/work/1713652269.80239/build.log for details.

cd /Users/you/.cpanm/work/1713652269.80239/Imager-File-GIF-0.98

perl Makefile.PL -v --incpath=/opt/homebrew/include --libpath=/opt/homebrew/var/homebrew/linked/giflib/lib

make
make test
make install
For some reason the following didn't work with the cpan client:
o conf makepl_arg "LIBS=-L/opt/homebrew/var/homebrew/linked/giflib/lib INC=-I/opt/homebrew/include"
PS - pkg-config can't find giflib so the paths were found like this:
sudo /usr/libexec/locate.updatedb

locate giflib
/opt/homebrew/var/homebrew/linked/giflib

locate gif_lib.h        
/opt/homebrew/Cellar/giflib/5.2.1/include/gif_lib.h
/opt/homebrew/include/gif_lib.h
  • Comment on Imager support for PNG, JPEG and GIF on macOS Sonoma

Replies are listed 'Best First'.
Re: Imager support for PNG, JPEG and GIF on macOS Sonoma
by etj (Priest) on May 14, 2024 at 13:29 UTC
    The way to get the Homebrew-installed location of a given package is (here) brew --prefix giflib, which would avoid needing the "locate" stuff.