diff --git a/var/spack/repos/builtin/packages/gmt/package.py b/var/spack/repos/builtin/packages/gmt/package.py
index 02400cb66e38618794554a670089b13684b94cf1..92932c885283603e8d15061e6bba8517754489af 100644
--- a/var/spack/repos/builtin/packages/gmt/package.py
+++ b/var/spack/repos/builtin/packages/gmt/package.py
@@ -64,6 +64,12 @@ class Gmt(Package):
     patch('regexp.patch', when='@6.1.0')
     patch('type.patch', when='@4.5.9')
 
+    executables = ['^gmt-config$']
+
+    @classmethod
+    def determine_version(cls, exe):
+        return Executable(exe)('--version', output=str, error=str).rstrip()
+
     @when('@5:')
     def install(self, spec, prefix):
         with working_dir('spack-build', create=True):