Building gmt-mex under OS X

We have tested both MATLAB® 2015a to 2016b - older versions may also work but we have not tested those under OS X. The steps to build gmt-mex are several:

  1. Install the GMT 5.3.2 OS X bundle from the main GMT Download page; this will add GMT-5.3.2 to /Applications.
  2. Run the script
    /Applications/GMT-5.3.2.app/Contents/Resources/share/tools/gmt_prepmex.sh
    This script will create a clone in /opt/gmt (so you will be asked for your sudo password) where all the shared libraries will be re-baptized to avoid clashes with MATLAB® shared libraries of the same names.
  3. Obtain the gmt-mex source code: cd into a suitable directory for development (e.g., GMTdev) and run
    svn co svn://gmtserver.soest.hawaii.edu/gmt-mex/trunk gmt-mex
  4. Make sure GMT 5.3.2 is in your path; Use gmtswitch to select your active GMT version if you have more than one installed (see the gmtswitch documentation if you have never used this facility before).
  5. In the gmt-mex directory, run
    autoconf
    ./configure --enable-matlab
  6. Then cd into src and run
    make all
    make install
    This should build the gmtmex.mexmaci64 application, which is needed by the gmt.m script you will be using, and install them with the rest of the GMT executables.
  7. Add /opt/gmt/bin to your MATLAB path, or alternatively copy these two files to a place where MATLAB can find them.