The Generic Mapping Tools (GMT) are a suite of tools for making maps. The graphics generated with default settings in GMT exceed in many ways those which would come out of most users’ ArcGIS work. Admittedly, GMT does come with a steep learning curve, not excluding the installation process. For earlier versions of GMT (4.x.x) installation is more simple and direct, as you can just install from the Ubuntu Software Center (or other package managers), however, these managers typically don’t have the most recent versions — in this case GMT version 5.1.x.
Without further adieu, in the following steps, we will collect the necessary components of the GMT install, compile, and install. Most of the guide comes from the GMT website, but is supplemented with some of what I think are helpful details for new users to GMT.
READ: This guide uses the terminal and a file explorer, but the entire install can be done from the terminal; in some steps incomplete commands to do operations via terminal are listed in square brackets […] where items in carrot brackets must be replaced with system/your-install specific items <…>. All terminal commands listed without brackets are required for successful install.
For Ubuntu 16.04 to 17.10:
sudo apt-get install subversion ghostscript build-essential cmake libnetcdf-dev libgdal1-dev libfftw3-dev libpcre3-devFor Ubuntu 18.04 (and later?):
sudo apt install subversion ghostscript build-essential cmake libnetcdf-dev libfftw3-dev libpcre3-dev libgdal-dev gdal-binsvn checkout svn://gmtserver.soest.hawaii.edu/gmt5/trunk gmt5-devwget http://gmt.soest.hawaii.edu/files/download?name=dcw-gmt-x.x.x.tar.gzcd ~/gmt5-devcp ./ && cp ./tar -zxvf gshhg-gmt-x.x.x.tar.gzcp ConfigUserTemplate.cmake ./ConfigUser.cmakegedit ConfigUser.cmakea. enable (uncomment) line 112 (set (GSHHG_ROOT…) and replace the path name with the absolute path to the gshhg-gmt-x.x.x folder.b. enable copy in line 115c. enable line 118 and replace the path name with the absolute path to the dcw-gmt-x.x.x folder.d. enable copy in line 121Save the file and return to the terminal. NOTE: the line numbers may change with updates by the GMT devs to the .cmake file.
mkdir buildcd buildcmake ..makesudo make installThat should complete your install of GMT 5.1.x! To test the install, try the following command into a new terminal window
gmt pscoast -R-130/-30/-50/50 -Jm0.025i -B30g30:.Mercator: -Di -W > mercator.ps