GMT 6.4 win64: gs: command not found

I am using gmt-6.4.0-win64.exe and when I run gs in the terminal I got this message:

bash: gs: command not found.

Is this ok?

Script (from the batch docs):

cat << EOF > pre.sh
gmt begin
    gmt coast -E=EU+l > countries.txt
gmt end
EOF
cat << EOF > main.sh
gmt begin \${BATCH_NAME} pdf
    gmt coast -R\${BATCH_WORD0}+r2 -JQ10c -Glightgray -Slightblue -B -B+t"\${BATCH_WORD1}" -E\${BATCH_WORD0}+gred+p0.5p
    echo \${BATCH_WORD0} | gmt text -F+f16p+jTL+cTL -Gwhite -W1p
gmt end
EOF
cat << EOF > post.sh
gs -dQUIET -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=\${BATCH_PREFIX}.pdf -dBATCH \${BATCH_PREFIX}_*.pdf
rm -f \${BATCH_PREFIX}_*.pdf
EOF
gmt batch main.sh -Sbpre.sh -Sfpost.sh -Tcountries.txt+w"\t" -Ncountries -V -W -Zs

I

If you are relying on the windows executables then the gs app is called gswin64c or something since it is a lot easier to type that than just gs… Maybe @Joaquim can suggest why we cannot have an alias for this on the win installation.

Maybe because I don’t know how to deal with symbolic links in the installer. Symbolic links on Windows are utterly stupid. They need administrator rights and even that is not activated by default in an administrator account (don’t know if that changed in Win11).
The easiest is really to create a local gs that symbolic link to gswin64c and put it somewhere in the path.

OK, maybe we should explain this to the common man as part of the installer?

Or, since we distribute this executable, could we just rename it gs or duplicate it and call the other gs?

Thanks Paul and Joaquim.

Since I had this issue I search an alternative for:

gs -dQUIET -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=\${BATCH_PREFIX}.pdf -dBATCH \${BATCH_PREFIX}_*.pdf

I found that this works. It looks fine altough the size of the files are slightly different (1.3 MB and 1.2 MB).

gmt psconvert -TF -F\${BATCH_PREFIX} \${BATCH_PREFIX}_*.pdf

Or do not use *nix only names in the scripts?
The problem in the copy solution is that if users have ghostscript installed that’s what is supposed to be used.

Maybe there is no good solution to anything here. But gs is the name of the executable. I do not know why the Windows version has to have win64c or similar added to it but that is what it is. It would be nice if the GMT script would just work on all OS. Here, it seems the solution is just to replace the gs call with gmt psconvert and problem solved.

@Esteban82, perhaps you can make a PR to update the batch docs example?

1 Like

An Artifex invention