# How to check where my GMT is installed on ubuntu?

**URL:** <https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466>\
**Category:** Q&A\
**Tags:** gmt\
**Created:** [December 22, 2021, 9:42pm UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466 "2021-12-22T21:42:24Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![leon6j](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@leon6j](https://forum.generic-mapping-tools.org/u/leon6j)\
**Post date:** [December 22, 2021, 9:42pm UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/1 "2021-12-22T21:42:24Z")

</div>

I’m trying to install GMT on my Ubuntu computer, by following this page: [https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md](https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md)

I copied the downloaded `gmt gshhg and dcw` files in to /opt/ and uncompressed them, configured the `cmake` files, and created the `build` folder at /opt/gmt-6.3.0/build/. The installation seemed to go through well.

Here is the problem. I have no idea where my GMT is installed. gmt --version will give me an error saying gmt is not installed. So what would be the path I need to add to my `.bashrc`? Is there a command that will enable me to find the path?

Many thanks.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [December 22, 2021, 10:50pm UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/2 "2021-12-22T22:50:45Z")

</div>

I guess ‘which gmt’ doesnt work either then.

Try:  
find -type f -name «gmt»

---

<div class="post-metadata">

**Author:** ![maxrjones](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/maxrjones/32/2698_2.png) [@maxrjones](https://forum.generic-mapping-tools.org/u/maxrjones)\
**Post date:** [December 22, 2021, 11:12pm UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/3 "2021-12-22T23:12:06Z")

</div>

The installation directory is set by CMAKE\_INSTALL\_PREFIX in `cmake/ConfigUser.cmake`. According to the template, it usually defaults to `usr/local` but I always set this rather than relying on the defaults (see [https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md#configuring](https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md#configuring))

---

<div class="post-metadata">

**Author:** ![leon6j](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@leon6j](https://forum.generic-mapping-tools.org/u/leon6j)\
**Post date:** [December 22, 2021, 11:46pm UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/4 "2021-12-22T23:46:05Z")

</div>

Thanks!

I returns nothing in my current directory, so I went all the way to the root directory but got the below error:

```
find -type f -name «gmt»
find: ‘./run/user/1000/gvfs’: Permission denied
```

---

<div class="post-metadata">

**Author:** ![leon6j](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@leon6j](https://forum.generic-mapping-tools.org/u/leon6j)\
**Post date:** [December 22, 2021, 11:49pm UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/5 "2021-12-22T23:49:50Z")

</div>

Thank you.

Here is my ConfigUser setting:  
`set (CMAKE_INSTALL_PREFIX “/opt/gmt-6.3.0”)`

Unfortunately, this below command returned nothing:  
$/opt/gmt-6.3.0/gmt --version  
bash: /opt/gmt-6.3.0/gmt: No such file or directory

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [December 23, 2021, 12:06am UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/6 "2021-12-23T00:06:09Z")

</div>

Well, presumably it is /opt/gmt-6.3.0/bin/gmt then. Look around in the build dir.

---

<div class="post-metadata">

**Author:** ![leon6j](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@leon6j](https://forum.generic-mapping-tools.org/u/leon6j)\
**Post date:** [December 23, 2021, 12:11am UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/7 "2021-12-23T00:11:45Z")

</div>

Many thanks, Paul.

I’m able to find the info from a install\_manifest.txt file. It turns out to be the below. Note the double quotation 🙂  
/opt/gmt-6.3.0/build/“/opt/gmt-6.3.0”/bin/

I thought that cmake link was supposed to be the link to the gmt installation file, without realizing it should be the destination file.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [December 23, 2021, 12:38am UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/8 "2021-12-23T00:38:59Z")

</div>

I would delete the build dir and rebuild after removing those quotes from the ConfigUser file.

---

<div class="post-metadata">

**Author:** ![leon6j](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@leon6j](https://forum.generic-mapping-tools.org/u/leon6j)\
**Post date:** [December 23, 2021, 12:51am UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/9 "2021-12-23T00:51:45Z")

</div>

OK. Thanks. I plan to start over the process.

BTW, where is the best location for the `"build"` folder, considering that my desired destination location for gmt is `/usr/local/` (default) and my downloaded and uncompressed sourced files for `gmt, gshhg, and dcw` are all located at `/opt/`?

The instruction says this:  
“To keep generated files separate from source files in the source tree, you should create a build directory in the top-level directory.”

I tried to create the “build” directory under /opt/, but got the below error:  
`CMake Error: The source directory "/opt" does not appear to contain CMakeLists.txt.`

Does that mean I would have to create the “build” file at `/opt/gmt-6.3.0`?

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [December 23, 2021, 1:43am UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/10 "2021-12-23T01:43:36Z")

</div>

If you want to install the GMT binaries and libraries in /opt/gmt-6.3.0/lib,include,bin.share etc then I would use /opt/gmt-6.3.0 as the prefix in the configure but where you do the configuration and build can be anywhere - it can be deleted when you are done anyway. SO I would do that in my home dir. I dont think you want the build dir and the prefix install dir to be the same.

---

<div class="post-metadata">

**Author:** ![leon6j](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@leon6j](https://forum.generic-mapping-tools.org/u/leon6j)\
**Post date:** [December 23, 2021, 2:06am UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/11 "2021-12-23T02:06:03Z")

</div>

Got you! Many thanks, Paul! Happy holidays.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [December 23, 2021, 4:22pm UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/12 "2021-12-23T16:22:04Z")

</div>

Sorry leon6j for my bad example of `find` and wrong quotation marks.

```auto
$ find [dir] -type f -name "gmt"

```

I have a `gmt` folder in my home directory where I put all gmt-related stuff. I install to the standard destination (`/usr/local/bin/`).

```auto
$ ls -l
total 16
drwxr-xr-x 9 anbj anbj 4096 Dec 23 10:58 b <-- build directory
drwxr-xr-x 11 anbj anbj 4096 Nov 24 20:03 gmt <-- gmt repo (from git clone)
drwxr-xr-x 4 anbj anbj 4096 Oct 23 20:28 share <-- gshhs and dcw

```

If you want to compile from source always, consider making an alias in your `.bashrc`;

```auto
gmtbuild() {
	cd ~/gmt/gmt
	git pull
	cd ~/gmt/b
	time (cmake ~/gmt/gmt -DCOPY_GSHHG=TRUE -DCOPY_DCW=TRUE -DGSHHG_ROOT=~/gmt/share/coast -DDCW_ROOT=~/gmt/share/dcw -DGMT_ENABLE_OPENMP=ON \
	&& cmake --build . --parallel $(getconf _NPROCESSORS_ONLN) \
	&& sudo cmake --build . --target install
	}

```

Then you’ll get bleeding edge gmt with a single command.

---

<div class="post-metadata">

**Author:** ![leon6j](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@leon6j](https://forum.generic-mapping-tools.org/u/leon6j)\
**Post date:** [December 25, 2021, 1:48am UTC](https://forum.generic-mapping-tools.org/t/how-to-check-where-my-gmt-is-installed-on-ubuntu/2466/13 "2021-12-25T01:48:06Z")

</div>

Many thanks, Andreas!
