Please note that all the SIEpedia's articles address specific issues or questions raised by IAC users, so they do not attempt to be rigorous or exhaustive, and may or may not be useful or applicable in different or more general contexts.
Compiling and installing PGPLOT in a Mac OS X box from source code, while not too complicated, requires some care and modifications to a couple of files.
You can also install pgplot via MacPorts; however, while it apparently includes the PNG driver, it does not include the TK driver, which I needed to build the E3D - The Euro3D Visualization Tool.
I managed to install PGPLOT with both the PNG and the TK drivers in an iMac with Lion v10.7.4. Here I explain step by step the installation procedure, which is based on the excellent Compiling PGPLOT on Mac OS X webpage by Benjamin Weiner.
/scratch/software/
as the root of the directory tree where I download and compile software packages; it's owned by myself. /usr/pkg/
is the root of the directory tree where packages are installed; it's owned by root, so we need to use sudo to work in it. Replace both directories with the paths of your choice.
cd /scratch/software/
wget -cNS --retr-symlinks ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot5.2.tar.gz
wget -cNS http://mingus.as.arizona.edu/~bjw/software/pgplot_macosx_conf.tar
tar -zxvf pgplot5.2.tar.gz
cd /scratch/software/pgplot/
tar -xvf ../pgplot_macosx_conf.tar
sudo mkdir -p /usr/pkg/pgplot
cd /usr/pkg/pgplot/
sudo cp /scratch/software/pgplot/drivers.list .
sudo nedit drivers.list
cd /scratch/software/pgplot/sys_macosx
nedit gfortran_gcc_64.conf
FCOMPL="/usr/local/bin/gfortran"
CCOMPL="/usr/local/bin/gcc"
SHARED_LIB=""
, so we do not create shared libs, only static).
cd /scratch/software/pgplot/
nedit makemake
pndriv.o : ./png.h ./pngconf.h ./zlib.h ./zconf.h
pndriv.o : /opt/local/include/png.h /opt/local/include/pngconf.h /opt/local/include/zlib.h /opt/local/include/zconf.h
nedit /scratch/software/pgplot/drivers/pndriv.c
cd /usr/pkg/pgplot/
sudo /scratch/software/pgplot/makemake /scratch/software/pgplot macosx gfortran_gcc_64
sudo make
cd
export PGPLOT_DIR="/usr/pkg/pgplot"
$PGPLOT_DIR/pgdemo2
/usr/local/bin/gfortran -o starpos -ffixed-line-length-132 -L/usr/pkg/pgplot -lpgplot -L/usr/X11/lib -lX11 -lpng starpos_linux.f
alias sudo='sudo '
(with the trailing space)