Switching between installed GMT versions

If you have both GMT 4 and 5 installed you may need to switch between these (and perhaps earlier versions as well). The gmtswitch program lets you do this, but first you must initialize the environment:

  1. Add $HOME/this_gmt/bin to your $PATH (bash) or $path (csh).
  2. Remove any other paths entries that point to any of your installed GMT versions.
  3. Create a file in your home directory called .gmtversions and enter the path to each GMT version top directory.
  4. Run gmtswitch and select which version to use.

For instance, this ~/.gmtversion file has three versions we can select from:


If gmtswitch is run without arguments it will present all versions and ask you to choose. If you give it an argument it will instead find the entry with a matching text and select it. E.g., given the above ~/.gmtversions file we could run

gmtswitch 4.5.9

and GMT 4.5.9 will be selected as the active GMT version.