gv for Mac OS X

12345678901234567890123456789012345678901234567890123456789012345678901234567890

gv is useful for displaying Postscript files, such as those created with GMT, from the command line and can be included easily in plotting scripts.

gv requires the Xaw3d libraries and header files. If these are not installed on your system, for example from XQuartz, one must install Xaw3d first. XQuartz 2.7.2 and later contain libXaw3d 1.6.2, which appears to have a problem, so see "Installing Xaw3d (version 1.6 and beyond)", below.

Installing Xaw3d (version 1.6 and beyond)

The distribution of Xaw3d was recently taken over by freedesktop.org. The source code has been suitably updated as of version 1.6 so as not to require the antiquated imake (or xmkmf) utility. It may now be installed using a standard configure-and-make routine described below. Information for installing Xaw3d up to version 1.5E can still be viewed on the old page here.

There appears to be a problem with the latest Xaw3d source code versions (1.6.1 and 1.6.2) when opening gv, so I recommend installing version 1.6 for use with gv. The version 1.6 source code may be downloaded as a bzip'd or gzip'd tar-file. Unzip and expand the tar-file in an appropriate directory. Change to the newly created libXaw3d-1.6/ directory.

To avoid having to install and use the pkg-config utility, add explicit environment variables to the configure command to call the necessary X11 headers and libraries:

./configure X11_CFLAGS='-I/usr/X11/include' X11_LIBS='-L/usr/X11/lib -lX11 -lXext -lXmu -lXt'

followed by the usual sequence of make commands, e.g.

make
sudo make install
make clean

This will install Xaw3d headers in /usr/local/include/X11/Xaw3d/ and libraries in /usr/local/lib/, which should make these available through the system's default paths.

Installing gv

With Xaw3d installed, one may now install gv from source. The source code is available here (latest version is 3.7.4). Unzip and expand the tar-file, and change to the newly created directory as before.

If you use the previous version, 3.7.3, there seems to be an (easily corrected) error in the source code of Scrollbar.c. A patch report suggests a solution by editing src/Scrollbar.c at line 1009:

(*swclass->threeD_class.shadowdraw) (w, event, region, FALSE);

to read

(*swclass->threeD_class.shadowdraw) (w, event, region, sbw->threeD.relief, FALSE);

On Mac, the configuration also seems to require the addition of the --enable-SIGCHLD-fallback flag. X11 libraries and header files should be found automatically but one should add explicit flags for the Xaw3d dependencies whose installation is described above, e.g.

./configure --enable-SIGCHLD-fallback X_CFLAGS='-I/usr/local/include' X_LIBS='-L/usr/local/lib'

where one should replace /usr/local/include and /usr/local/lib with the location of the Xaw3d header files and libraries, respectively. Then execute the usual sequence of make commands, e.g.

make
sudo make install
make clean

This will install gv in /usr/local/bin/, which should make gv available through the system's default paths.