# PostScript file creation on GMT6

**URL:** https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933
**Category:** Q&A
**Created:** [October 7, 2020, 12:19pm UTC](https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933 "2020-10-07T12:19:27Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![ggab](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@ggab](https://forum.generic-mapping-tools.org/u/ggab)
#### Post date: [October 7, 2020, 12:19pm UTC](https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933/1 "2020-10-07T12:19:27Z")

</div>

Hello everyone,  
I am using GMT 6.1.0 and I don’t know how to create my “ps” file in the right directory.  
Let me explain.

I am a script with the line command : “gmt begin MyPlot X D/MyDirectory”

if X format is pdf, png, jpg, It’s OK. The file MyPlot.X is created in the good directory.

If X is “ps”, the file is created in the directory of the script execution.

Thank for your help,  
Regards  
Germinal

---

<div class="post-metadata">

### Author: ![MarceloBanik](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marcelobanik/32/479_2.png) [@MarceloBanik](https://forum.generic-mapping-tools.org/u/MarceloBanik)
#### Post date: [October 7, 2020, 1:27pm UTC](https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933/2 "2020-10-07T13:27:27Z")

</div>

using the following commands on Linux:

> #!/bin/bash  
> for X in pdf png jpg ps; do  
> gmt begin $PWD/D/MyDirectory/MyPlot $X  
> gmt basemap -R0/2/0/2 -Jx5c -Ba0.5  
> gmt end  
> done

The MyPlot.ps is created in the current directory, both to GMT 6.2.0 and 6.1.0  
Should open an issue in the GitHub?

---

<div class="post-metadata">

### Author: ![ggab](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@ggab](https://forum.generic-mapping-tools.org/u/ggab)
#### Post date: [October 7, 2020, 3:22pm UTC](https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933/3 "2020-10-07T15:22:04Z")

</div>

Hello MarceloBanik,  
Thank for the response but I have not the same thing.

I am in the D1 directory witch contain a TEST2 directory with the csh1 script below:  
#!/bin/bash

gmt begin $PWD/TEST2/MyPlot pdf  
gmt basemap -R0/2/0/2 -Jx5c -Ba0.5  
gmt end

gmt begin $PWD/TEST2/MyPlot jpg  
gmt basemap -R0/2/0/2 -Jx5c -Ba0.5  
gmt end  
gmt begin $PWD/TEST2/MyPlot ps  
gmt basemap -R0/2/0/2 -Jx5c -Ba0.5  
gmt end

If I launch this script : csh TEST/csh1  
MyPlot.jpg and MyPlot.pdf are created in the good directory ($PWD/TEST2)  
MyPlot.ps is created in $PWD

---

<div class="post-metadata">

### Author: ![MarceloBanik](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marcelobanik/32/479_2.png) [@MarceloBanik](https://forum.generic-mapping-tools.org/u/MarceloBanik)
#### Post date: [October 7, 2020, 3:36pm UTC](https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933/4 "2020-10-07T15:36:22Z")

</div>

as current directory == $PWD, then we have the same results, and I thing it is a bug.

---

<div class="post-metadata">

### Author: ![MarceloBanik](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marcelobanik/32/479_2.png) [@MarceloBanik](https://forum.generic-mapping-tools.org/u/MarceloBanik)
#### Post date: [October 7, 2020, 8:10pm UTC](https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933/5 "2020-10-07T20:10:13Z")

</div>

running with option -Vd, I noted that when it is ps, it says:

> psconvert [DEBUG]: Copying /home/marcelo/.gmt/sessions/gmt\_session.139980/psconvert\_139983d.eps → MyPlot.ps

when it is pdf, it says:

> psconvert [DEBUG]: Running:  
> gs -q … -sOutputFile=‘/home/marcelo/gmt/forum/tmp/D/MyDirectory/MyPlot.pdf’ …

So appears that the problem is in the psconvert module.

---

<div class="post-metadata">

### Author: ![MarceloBanik](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marcelobanik/32/479_2.png) [@MarceloBanik](https://forum.generic-mapping-tools.org/u/MarceloBanik)
#### Post date: [October 7, 2020, 8:57pm UTC](https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933/6 "2020-10-07T20:57:11Z")

</div>

appears that, at least for the simple test I posted here, the following patch solve this issue.[fix\_ps\_path.zip](https://forum.generic-mapping-tools.org/uploads/short-url/1KUl3hkw52DvOLJNHGALyKV1QVP.zip) (841 Bytes)

---

<div class="post-metadata">

### Author: ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)
#### Post date: [October 7, 2020, 9:40pm UTC](https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933/7 "2020-10-07T21:40:27Z")

</div>

@MarceloBanik, maybe a PR please?

---

<div class="post-metadata">

### Author: ![MarceloBanik](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marcelobanik/32/479_2.png) [@MarceloBanik](https://forum.generic-mapping-tools.org/u/MarceloBanik)
#### Post date: [October 7, 2020, 11:09pm UTC](https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933/8 "2020-10-07T23:09:15Z")

</div>

I hope I did it correctly:  
save the PS file including the path  
#4298 opened 2 minutes ago by MarceloBanik

---

<div class="post-metadata">

### Author: ![ggab](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@ggab](https://forum.generic-mapping-tools.org/u/ggab)
#### Post date: [October 13, 2020, 3:56pm UTC](https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933/9 "2020-10-13T15:56:17Z")

</div>

Hello,  
Sorry for the delay !  
Thanks for the solution but now, with the GMT5 version and later, I don’t knows where are the sources and how do to include your patch ?  
Regards  
Germinal

---

<div class="post-metadata">

### Author: ![MarceloBanik](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/marcelobanik/32/479_2.png) [@MarceloBanik](https://forum.generic-mapping-tools.org/u/MarceloBanik)
#### Post date: [October 13, 2020, 5:06pm UTC](https://forum.generic-mapping-tools.org/t/postscript-file-creation-on-gmt6/933/10 "2020-10-13T17:06:41Z")

</div>

as the correction has already been done in the source code, I think the easiest way is to install from it. See:  
[https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md](https://github.com/GenericMappingTools/gmt/blob/master/BUILDING.md)
