# Instructions to install GMT.jl on Ubuntu

**URL:** https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486
**Category:** General Usage
**Tags:** question, ubuntu, gmt
**Created:** [December 22, 2021, 1:31pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486 "2021-12-22T13:31:16Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)
#### Post date: [December 22, 2021, 1:31pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/1 "2021-12-22T13:31:16Z")

</div>

Is this the correct way of installing GMT.jl on Ubuntu?  
[https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md#build-and-runtime-dependencies](https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md#build-and-runtime-dependencies)

It seems there are a lot of manual steps.

---

<div class="post-metadata">

### Author: ![Fliks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fliks/32/2494_2.png) [@Fliks](https://discourse.julialang.org/u/Fliks)
#### Post date: [December 22, 2021, 1:39pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/2 "2021-12-22T13:39:36Z")

</div>

You shouldn’t have to build GMT yourself, rather use the available GMT package from apt:  
`sudo apt-get install gmt gmt-dcw gmt-gshhg`

this is from here:  
[https://github.com/GenericMappingTools/gmt/blob/master/INSTALL.md#ubuntudebian](https://github.com/GenericMappingTools/gmt/blob/master/INSTALL.md#ubuntudebian)

And the GMT.jl [README](https://github.com/GenericMappingTools/GMT.jl#install) says, that it would install it via conda if it is not available in the system.

When you have installed the GMT package you can install the GMT.jl package in Julia via:

```julia
pkg>add GMT 

```

---

<div class="post-metadata">

### Author: ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)
#### Post date: [December 22, 2021, 1:47pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/3 "2021-12-22T13:47:57Z")

</div>

Many thanks!

As a newbie to Linux, I’m very glad to hear about this.

---

<div class="post-metadata">

### Author: ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)
#### Post date: [December 22, 2021, 1:55pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/4 "2021-12-22T13:55:18Z")

</div>

Unfortunately, I got the below error, while running Pkg.add(“GMT”):

**ERROR:** The following 1 direct dependency failed to precompile:  
GMT [5752ebe1-31b9-557e-87aa-f909b540aa54]  
Failed to precompile GMT [5752ebe1-31b9-557e-87aa-f909b540aa54] to /home/name/.julia/compiled/v1.7/GMT/jl\_96Uy7O.  
ldd: /usr/lib/x86\_64-linux-gnu/libgmt.so: No such file or directory  
**ERROR:** LoadError: failed processes:  
Process(`ldd /usr/lib/x86_64-linux-gnu/libgmt.so`, ProcessExited(1)) [1]  
Process(`grep libgdal`, ProcessExited(1)) [1]

---

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [December 22, 2021, 4:58pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/5 "2021-12-22T16:58:00Z")

</div>

> [@leon](#):
>
> ldd: /usr/lib/x86\_64-linux-gnu/libgmt.so: No such file or directory

My guess is that you installed from one of those package managers that do not create a symbolic link to the library as is common use on unix and that is why it doesn’t find the `libgmt.so`

If you run, **in a unix shell** , `gmt --show-bindir` it will show you the location of the GMT executable. Then use `ldd` to find its dependencies. Something like

```julia
ldd /usr/bin/gmt | grep libgmt

```

you will see references to (in my linux box)

```julia
libgmt.so.6 => /lib64/libgmt.so.6 (0x00007f45f97ee000)

```

and

```julia
[jluis@fct-gmt lib64]$ ls /usr/lib64/libgmt*
/usr/lib64/libgmt.so /usr/lib64/libgmt.so.6 /usr/lib64/libgmt.so.6.1.0

```

The problem in your case (again, my guess) is that your installation lacks the `libgmt.so`, which is a symbolic link ( **that should be there** ). The solution is to create one yourself (in the directory of the shared libs, `/usr/lib64/` in this example) do

```julia
ln -s libgmt.so libgmt.so.6

```

---

<div class="post-metadata">

### Author: ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)
#### Post date: [December 22, 2021, 6:38pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/6 "2021-12-22T18:38:42Z")

</div>

Many thanks, Joa-quim! Unfortunately, it did not work.

**Path to the file:** /lib/x86\_64-linux-gnu/

`$ ln -s libgmt.so libgmt.so.6`  
ln: failed to create symbolic link ‘libgmt.so.6’: File exists

> [@joa-quim](#):
>
> `ln -s libgmt.so libgmt.so.6`

---

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [December 22, 2021, 6:55pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/7 "2021-12-22T18:55:10Z")

</div>

So it’s the other way around. I never remember the order.

```julia
ln -s libgmt.so.6 libgmt.so

```

---

<div class="post-metadata">

### Author: ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)
#### Post date: [December 22, 2021, 7:05pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/8 "2021-12-22T19:05:13Z")

</div>

> [@joa-quim](#):
>
> `ln -s libgmt.so.6 libgmt.so`

Many thanks! I think it did something good. However, when I tried `Pkg.add("GMT")`, it went through the process really quickly. I got a different error when `using GMT`.

` **ERROR:** InitError: failed process: Process(`gmt --show-userdir`, ProcessExited(78)) [78]`

Below are the details:

(@v1.6) pkg\> add GMT  
Updating registry at `~/.julia/registries/General`  
Resolving package versions…  
No Changes to `~/.julia/environments/v1.6/Project.toml`  
No Changes to `~/.julia/environments/v1.6/Manifest.toml`

julia\> using GMT  
[Info: Precompiling GMT [5752ebe1-31b9-557e-87aa-f909b540aa54]

```
GMT - The Generic Mapping Tools, Version 6.0.0 [64-bit] [12 cores]
(c) 1991-2019 The GMT Team (https://www.generic-mapping-tools.org/team.html).

```

Supported in part by the US National Science Foundation ([http://www.nsf.gov/](http://www.nsf.gov/))  
and volunteers from around the world.

GMT is distributed under the GNU LGP License ([http://www.gnu.org/licenses/lgpl.html](http://www.gnu.org/licenses/lgpl.html)).

usage: gmt [options]  
gmt []

options:  
–help List descriptions of available GMT modules.  
–new-script[=L] Write GMT modern mode script template to stdout.  
Optionally specify bash|csh|batch [Default is current shell]  
–show-bindir Show directory with GMT executables.  
–show-citation Show the most recent citation for GMT.  
–show-cores Show number of available cores.  
–show-datadir Show directory/ies with user data.  
–show-dataserver Show URL of the remote GMT data server.  
–show-doi Show the DOI for the current release.  
–show-modules Show all module names.  
–show-library Show path of the shared GMT library.  
–show-plugindir Show directory for plug-ins.  
–show-sharedir Show directory for shared GMT resources.  
–version Print GMT version number.

if is ‘=’ we call exit (0) if module exist and non-zero otherwise.

```
GMT - The Generic Mapping Tools, Version 6.0.0 [64-bit] [12 cores]
(c) 1991-2019 The GMT Team (https://www.generic-mapping-tools.org/team.html).

```

Supported in part by the US National Science Foundation ([http://www.nsf.gov/](http://www.nsf.gov/))  
and volunteers from around the world.

GMT is distributed under the GNU LGP License ([http://www.gnu.org/licenses/lgpl.html](http://www.gnu.org/licenses/lgpl.html)).

usage: gmt [options]  
gmt []

options:  
–help List descriptions of available GMT modules.  
–new-script[=L] Write GMT modern mode script template to stdout.  
Optionally specify bash|csh|batch [Default is current shell]  
–show-bindir Show directory with GMT executables.  
–show-citation Show the most recent citation for GMT.  
–show-cores Show number of available cores.  
–show-datadir Show directory/ies with user data.  
–show-dataserver Show URL of the remote GMT data server.  
–show-doi Show the DOI for the current release.  
–show-modules Show all module names.  
–show-library Show path of the shared GMT library.  
–show-plugindir Show directory for plug-ins.  
–show-sharedir Show directory for shared GMT resources.  
–version Print GMT version number.

if is ‘=’ we call exit (0) if module exist and non-zero otherwise.

ERROR: InitError: failed process: Process(`gmt --show-userdir`, ProcessExited(78)) [78]

Stacktrace:  
[1] pipeline\_error  
@ ./process.jl:525 [inlined]  
[2] (::Base.var"#644#645"{Base.Process})()  
@ Base ./process.jl:319  
[3] iterate(itr::Base.EachLine{Base.PipeEndpoint}, state::Nothing) (repeats 2 times)  
@ Base ./io.jl:1014  
[4] \_collect(cont::UnitRange{Int64}, itr::Base.EachLine{Base.PipeEndpoint}, #unused#::Base.HasEltype, isz::Base.SizeUnknown)  
@ Base ./array.jl:613  
[5] collect  
@ ./array.jl:602 [inlined]  
[6] #readlines#340  
@ ./io.jl:551 [inlined]  
[7] readlines  
@ ./io.jl:551 [inlined]  
[8] **init** (test::Bool)  
@ GMT ~/.julia/packages/GMT/XBGE9/src/GMT.jl:280  
[9] **init** ()  
@ GMT ~/.julia/packages/GMT/XBGE9/src/GMT.jl:260  
[10] \_include\_from\_serialized(path::String, depmods::Vector{Any})  
@ Base ./loading.jl:696  
[11] \_require\_from\_serialized(path::String)  
@ Base ./loading.jl:749  
[12] \_require(pkg::Base.PkgId)  
@ Base ./loading.jl:1053  
[13] require(uuidkey::Base.PkgId)  
@ Base ./loading.jl:936  
[14] require(into::Module, mod::Symbol)  
@ Base ./loading.jl:923  
during initialization of module GMT

---

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [December 22, 2021, 7:25pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/9 "2021-12-22T19:25:48Z")

</div>

Oh man you have a nose to fall into troubles. That’s Ubuntu _stability_ installing a old GMT version (6.0.0) (\> 2 years). I had to drop support that version in GMT.jl

As I see it, you either find a way to use packagers that install a newer version (there is a way but I don’t remember), or build from source, or remove it and let the default Conda version be installed.

I’m a happy Windows user, \*nix is not good for my sanity.

---

<div class="post-metadata">

### Author: ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)
#### Post date: [December 22, 2021, 7:39pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/10 "2021-12-22T19:39:22Z")

</div>

Many thanks for your big help anyway! Happy holidays…

---

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [December 22, 2021, 7:42pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/11 "2021-12-22T19:42:22Z")

</div>

Season greetings for you too.

---

<div class="post-metadata">

### Author: ![Fliks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fliks/32/2494_2.png) [@Fliks](https://discourse.julialang.org/u/Fliks)
#### Post date: [December 23, 2021, 1:06pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/12 "2021-12-23T13:06:48Z")

</div>

If you are on a long term support version of Ubuntu, this means, Ubuntu 20.04 or 18.04 you should be able to get GMT version 6.1.1 from the UbuntuGIS PPA

To add the UbuntuGIS PPA to your list of repositories do:

```julia
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ppa

```

as described [here](https://trac.osgeo.org/ubuntugis/wiki/UbuntuGISRepository).

Then you should reinstall GMT and get the version 6.1.1  
You might have to do the soft link again after reinstallation.

---

<div class="post-metadata">

### Author: ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)
#### Post date: [December 23, 2021, 2:18pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/13 "2021-12-23T14:18:18Z")

</div>

Many thanks!

I’m able to build one from source files by following the below link:  
[https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md](https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md)

Now I have GMT 6.3.0 running successfully on my machine and also on my Julia.

---

<div class="post-metadata">

### Author: ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)
#### Post date: [December 23, 2021, 7:54pm UTC](https://discourse.julialang.org/t/instructions-to-install-gmt-jl-on-ubuntu/73486/14 "2021-12-23T19:54:14Z")

</div>

Nice. And sorry but haven’t had time to give this other suggestion. If you are building from source then with just a small extra step you can build the master version from Github. The interest is when this [GMT issue](https://github.com/GenericMappingTools/gmt/issues/6137) is worked out, it will give native support for the Interrupted Good Homolosine projection. See the [amazing images](https://user-images.githubusercontent.com/26473567/146867970-96c7ad20-0f1c-41aa-bf9f-5ef7a17df8ab.jpg) at at the issue page that Paul created with a twisted bash script.
