Install GMT 4.5.18 on macOS Catalina

Notes on debugging a GMT 4.5.18 install on macOS Catalina 10.15.7 (to use with NonLinLoc).

Start by following the instructions to install GMT dependencies here: I installed dependencies on macOS via Homebrew:

# install necessary dependencies
brew install cmake curl netcdf

# and optional dependencies
brew install gdal pcre2 fftw glib ghostscript

# to enable movie-making
brew install graphicsmagick ffmpeg

# to build the documentation
brew install sphinx-doc

# add sphinx-doc to your PATH
echo 'export PATH="$(brew --prefix)/opt/sphinx-doc/bin:$PATH"' >> ~/.bashrc

Then download the source code tarball via the GMT GitHub Wiki: Untar by double-clicking the downloaded file. Open a terminal window, then:

# make the downloaded gmt directory the working directory
cd Downloads/gmt-4.5.18

# run the configure script

# run the makefile

At this point, I received an error.

Making all in src/xgrid
gcc -O2 -Wall  -fPIC -fno-strict-aliasing -std=c99 -I/Users/human/gmt-4.5.18/src  -I/usr/local/Cellar/netcdf/4.8.1/include     -c -o xgrid_utility.o xgrid_utility.c
xgrid_utility.c:5:10: fatal error: 'X11/Intrinsic.h' file not found
#include <X11/Intrinsic.h>
1 error generated.
make[2]: *** [xgrid_utility.o] Error 1
make[1]: *** [xgrid] Error 2
make: *** [suppl] Error 2

This is resolved by installing libxt via Homebrew:

brew install libxt

Then retry running the makefile:

make clean

At this point, I received another error.

xgrid_Panner.c:4:10: fatal error: 'X11/Xaw/Scrollbar.h' file not found
#include <X11/Xaw/Scrollbar.h>
1 error generated.
make[2]: *** [xgrid_Panner.o] Error 1
make[1]: *** [xgrid] Error 2
make: *** [suppl] Error 2

This is resolved by installing libxaw via Homebrew:

brew install libxaw

Retry the makefile again:

make clean

No errors, success! Now install the executables:

make install-gmt

Then install supporting data like coastlines:

make install-data

And finally, add the bin directory to your path via your .bashrc file:

echo 'export PATH=~/Downloads/gmt-4.5.18/bin:$PATH' >> ~/.bashrc

Check your install by typing gmt in Terminal. If successful you will see:

GMT - The Generic Mapping Tools data processing and display software package
                                Version 4.5.18
GMT is a collection of public-domain Unix tools that allows you to manipulate
x,y and x,y,z data sets (filtering, trend fitting, gridding, projecting, etc.)
and to produce PostScript illustrations ranging from simple x-y plots, via
contour maps, to artificially illuminated surfaces and 3-D perspective views
in black/white or full color.  Linear, log10, and power scaling are supported
in additon to 25 common map projections.  The processing and display routines
within GMT are completely general and will handle any (x,y) or (x,y,z) data
as input.

The following is a summary of all the programs supplied with GMT and
a very short descriptions of their purpose. Detailed information about each program
can be found in each program's manual page.

        blockmean       L2 (x,y,z) data filter/decimator
        blockmedian     L1 (x,y,z) data filter/decimator
        blockmode       Mode (x,y,z) data filter/decimator
        filter1d        Filter 1-D data sets (time series)
        fitcircle       Finds best-fitting great circle to a set of points
        gmt2rgb         Convert Sun rasterfile or grid to r, g, b grids
        gmtconvert      Convert between ASCII and binary 1-D tables
        gmtdefaults     List the current default settings
        gmtmath         Mathematical operations on data tables
        gmtset          Set individual default parameters
        gmtselect       Extract data subsets based on spatial criteria
        grd2cpt         Make color palette table from grid files
        grd2xyz         Conversion from 2-D grid file to table data
        grdblend        Blend several partially over-lapping grid files onto one grid
        grdclip         Limit the z-range in gridded data
        grdcontour      Contouring of 2-D gridded data
        grdcut          Cut a sub-region from a grid file
        grdedit         Modify header information in a 2-D grid file
        grdfft          Operate on grid files in the wavenumber (or frequency) domain
        grdfilter       Filter a 2-D grid file in the space (or time) domain
        grdgradient     Compute directional gradient from grid files
        grdhisteq       Histogram equalization for grid files
        grdimage        Produce images from 2-D gridded data
        grdinfo         Get information about grid files
        grdlandmask     Create mask grid file from shoreline data base
        grdmask         Reset nodes outside a clip path to a constant
        grdmath         Mathematical operations on grid files
        grdpaste        Paste together grid files along a common edge
        grdproject      Project gridded data onto a new coordinate system
        grdreformat     Converting between different grid file formats
        grdsample       Resample a 2-D gridded data set onto a new grid
        grdtrend        Fits polynomial trends to grid files
        grdtrack        Sampling of 2-D data set along 1-D track
        grdvector       Plot vector fields from grid files
        grdview         3-D perspective imaging of 2-D gridded data
        grdvolume       Volume calculations from 2-D gridded data
        greenspline     Interpolation using Green's functions for splines in 1-3 dimensions
        makecpt         Make color palette tables
        mapproject      Forward or inverse map projections of table data
        minmax          Find extreme values in data tables
        nearneighbor    Nearest-neighbor gridding scheme
        project         Project data onto lines/great circles
        ps2raster       Crop and convert PostScript files to raster images, EPS, and PDF
        psbasemap       Create a basemap plot
        psclip          Use polygon files to define clipping paths
        pscoast         Plot coastlines and filled continents on maps
        pscontour       Contour xyz-data by triangulation
        pshistogram     Plot a histogram
        psimage         Plot images (EPS or Sun raster files) on maps
        pslegend        Plot legend on maps
        psmask          Create overlay to mask out regions on maps
        psrose          Plot sector or rose diagrams
        psscale         Plot gray scale or color scale on maps
        pstext          Plot text strings on maps
        pswiggle        Draw time-series along track on maps
        psxy            Plot symbols, polygons, and lines on maps
        psxyz           Plot symbols, polygons, and lines in 3-D
        sample1d        Resampling of 1-D table data
        spectrum1d      Compute various spectral estimates from time-series
        splitxyz        Split xyz-files into several segments
        surface         A continuous curvature gridding algorithm
        trend1d         Fits polynomial or Fourier trends to y = f(x) data
        trend2d         Fits polynomial trends to z = f(x,y) data
        triangulate     Perform Delaunay triangulation and gridding
        xyz2grd         Convert equidistant xyz data to a 2-D grid file

Look up the individual man pages for more details and full syntax.
Those man pages are installed in /Users/human/gmt-4.5.18/share/man/man?.
Information is also available on the GMT World Wide Web home page
( and, if installed, locally from

Default locations of GMT components:
        executables     /Users/human/gmt-4.5.18/bin
        library         /Users/human/gmt-4.5.18/lib
        shared data     /Users/human/gmt-4.5.18/share
        manual pages    /Users/human/gmt-4.5.18/share/man/man?
        documentation   /Users/human/gmt-4.5.18/share/doc/

The user has control over the following environment variables:

        location of shared data (including subdirectories coast, cpt, etc.):
                GMT_SHAREDIR = /Users/human/gmt-4.5.18/share (default)

        user-specific configurations (color tables, .gmtdefaults, etc.):
                GMT_USERDIR = /Users/human/.gmt (default)

        user-specific data (grids, column data):
                GMT_DATADIR = (undefined)

        other deprecated data directories:
                GMT_GRIDDIR = (undefined)
                GMT_IMGDIR = (undefined)