PGPLOT for Mac OS X

Last modified: 2005-05-10.

This is a beta-test version of PGPLOT for Mac OS X. It is available in source and binary form. The binary should work with Mac OS 10.3 (Panther); I don't know if it works with 10.4 (Tiger). You cannot use the binary distribution if you want to add or remove drivers. The default set includes most of the drivers that are useful on Mac OS as well as some that are probably obsolete.

Installation from Source Code

Compilers

You will need

Check that commands gcc and g77 invoke the compilers. You can use shell script compiler-test.sh to do this. Download the script, make it executable, and run it from within a Terminal window.

chmod +x ./compiler-test.sh
./compiler-test.sh

It will print out a lot of details about the compilers, and if it is successful it will also write

**** C compiler is working.
**** Fortran compiler is working.

If you are having trouble getting the compilers to work, capture the output of the script

./compiler-test.sh >compiler-test.log 2>&1
or
./compiler-test.sh >& compiler-test.log

and send me the resulting log file. The first command is for sh, bash and similar shells; the second is for csh and tcsh shells.

X-window System

Install the Apple X11 system and its development kit.

[Instructions to be added.]

Download the Distribution File

Download the following file into a working directory to your Mac OS disk.

Unpack the tar file

The download may do this for you; if not, use the following commands (in a terminal window):

gunzip -c pgplot531.tar.gz | tar xf -

This creates subdirectory pgplotsrc. We will compile PGPLOT in a separate subdirectory of the working directory, pgplot. Type the following commands.

mkdir pgplot
cd pgplot
cp ../pgplotsrc/drivers.list . 
../pgplotsrc/makemake ../pgplotsrc darwin g77_gcc 
make

Binary Installation

Download the disk image:

The disk image contains two folders (directories): pgplotsrc contains the source code and documentation, and pgplot contains the compiled libraries and demo programs.

Files needed at run time; Environment variables

You will need the following files from the PGPLOT directory at run time.

pgxwin_server
grfont.dat
rgb.txt

PGPLOT programs need to be able to find these files. You need to define an environment variable PGPLOT_DIR to point to this directory, e.g.,

setenv PGPLOT_DIR path/pgplot
or
PGPLOT_DIR=path/pgplot ; export PGPLOT_DIR

Specify the full path of the pgplot directory you created during the installation.

Run the Demo Programs

Make sure X11 is running. Then, in an xterm window, type, e.g.,

pgplot/pgdemo1

The program will prompt for device spec. Specify /xserv to display in an X window, or filename.ps/cps to create a PostScript file. Type ? to see other options. PostScript files can be displayed with the Apple Preview application, or another PostScript viewer program.

Compiling and Running your own Programs

To compile a Fortran program app:

g77 -o app app.f -Lpath/pgplot -lpgplot -L/usr/X11R6/lib -lX11 -L/usr/lib -lgcc

To compile a C program app:

gcc -c -Ipath/pgplot app.c
g77 -o app app.o -Lpath/pgplot -lcpgplot -lpgplot -L/usr/X11R6/lib -lX11 -L/usr/lib -lgcc

Documentation

Some documentation is included: point your web browser to file pgplotsrc/doc/doc-index.html.

Notes

Problems?

Please send e-mail to Tim Pearson, tjp[at]astro.caltech.edu. I welcome feedback and suggestions for improvement.


PGPLOT