GenericMappingTools / 2020-unavco-course

Planning and material for the 2020 UNAVCO GMT for Geodesy course
34 stars 18 forks source link

Trouble completing installation on MacBook Pro and adding the GMT application to my PATH environment #23

Closed eraymondjames closed 3 years ago

eraymondjames commented 4 years ago

Hello,

I added tried to install using the Application Bundle for MacOS. After following the instructions for that, do I need to install via Homebrew or MacPorts or fink? Or should my installation be complete with what I did so far?

After installing using the Application Bundle instructions, I tried adding the GMT programs contained in the application bundle to your search path for executables but I'm not really sure how I'm supposed to do that. Can someone help me with what my code should look like. I used this in the past but it didn't work and I'm very new to unix: "echo "export PATH=/Applications/GMT-6.0.0rc4/Contents/Resources/bin:$PATH" >> ~.bashrc"

PaulWessel commented 4 years ago

I recommend you simply start GMT from the icon in /Applications and a terminal will open up that has all the path stuff set correctly for this GMT version. You can open more than one such terminal.

ALso, not sure what you mean by GMT-6.0.0rc4 from 2019? Was that just an example or a previous effort?

eraymondjames commented 4 years ago

Hi Paul,

Thanks for your reply.

Yes, the 'GMT-6.0.0rc4' is what I used last year when I was trying to install GMT on my own. I put that line to find out if I was on the right track with the line of code needed to add the GMT application to my PATH environment. Sorry for the confusion, I really am just a bit lost in terms of what the lines of code should be based on the instructions as this is all new to me.

I have been starting GMT from the icon as you suggested, and below is what I get on the terminal that opens. I tried using the line of code in #1 (i.e. export GMTHOME=/private/var/folders/28/tt4s7m1565ggdbpsfcn6cjrr0000gp/T/AppTranslocation/92B065D4-F75B-43BF-878A-6DA980256B7C/d/GMT-6.1.0.app/Contents/Resources) but initially got a message saying 'not a valid identifier.' I tried it again and I think it went through.

Can I please have some assistance with part b? I tried and got the 'not a valid identifier' error again. What should my line of code look like for that part? I should be able to do c) and d) once I get part b) - hopefully.

Note from my terminal after launching GMT from the icon: Note 1: If you want to use GMT outside of this terminal or in scripts, then follow these steps: a) export GMTHOME=/private/var/folders/28/tt4s7m1565ggdbpsfcn6cjrr0000gp/T/AppTranslocation/92B065D4-F75B-43BF-878A-6DA980256B7C/d/GMT-6.1.0.app/Contents/Resources b) add $GMTHOME/bin to your path c) export PROJ_LIB=$GMTHOME/share/proj d) export MAGICK_CONFIGURE_PATH=$GMTHOME/lib/GraphicsMagick/config Note 2: GMT may use Ghostscript, GraphicsMagick, FFmpeg, and GDAL executables; see /private/var/folders/28/tt4s7m1565ggdbpsfcn6cjrr0000gp/T/AppTranslocation/92B065D4-F75B-43BF-878A-6DA980256B7C/d/GMT-6.1.0.app/Contents/Resources/share/Licenses for details.

PaulWessel commented 4 years ago

If you start from the GMT icon then you don't do any of that. It is only for people who want to add this particular search path to their PATH variable so they can run it from terminals not started this way, but that needs to be done knowing what you do. Ignore and just run GMT from the terminal you opened and all will be fine.

eraymondjames commented 4 years ago

Two things: 1) was trying to carry out those steps because I do want to use it outside of terminals started that way and with scripts. I used GMT in the past and have a number of scripts that I'd like to be able to run so being able to complete these steps is important for what I need to do. 2) In terms of working in terminals opened that way, I'm not getting GMT to run. I tried the first part of the homework assignment and got the following: bash-3.2$ cd 2020-unavco-course/hw1/ bash-3.2$ ./test_1.sh ./test_1.sh: /private/var/folders/28/tt4s7m1565ggdbpsfcn6cjrr0000gp/T/AppTranslocation/1AA1B3AC-6EEE-4479-96B3-C7156105770A/d/GMT-6.1.0.app/Contents/Resources/bin/gmt: No such file or directory ./test_1.sh: /private/var/folders/28/tt4s7m1565ggdbpsfcn6cjrr0000gp/T/AppTranslocation/1AA1B3AC-6EEE-4479-96B3-C7156105770A/d/GMT-6.1.0.app/Contents/Resources/bin/gmt: No such file or directory ./test_1.sh: /private/var/folders/28/tt4s7m1565ggdbpsfcn6cjrr0000gp/T/AppTranslocation/1AA1B3AC-6EEE-4479-96B3-C7156105770A/d/GMT-6.1.0.app/Contents/Resources/bin/gmt: No such file or directory ./test_1.sh: /private/var/folders/28/tt4s7m1565ggdbpsfcn6cjrr0000gp/T/AppTranslocation/1AA1B3AC-6EEE-4479-96B3-C7156105770A/d/GMT-6.1.0.app/Contents/Resources/bin/gmt: No such file or directory bash-3.2$

Would you happen to know where I went wrong?

seisman commented 4 years ago

This is not the correct path:

/private/var/folders/28/tt4s7m1565ggdbpsfcn6cjrr0000gp/T/AppTranslocation/1AA1B3AC-6EEE-4479-96B3-C7156105770A/d/GMT-6.1.0.app/Contents/Resources/bin/gmt:

Usually this is the temporary path where you mount the GMT DMG file.

After you drag the GMT bundle to /Applications directory, you should see an icon in /Applications directory. Double click the icon, then you should see that the correct path is

/Applications/GMT-6.1.0.app/Contents/Resources/bin/gmt
eraymondjames commented 4 years ago

Thank you very much. This was very helpful - I now know what I was doing wrong. I was able to get GMT to run and complete the homework exercises for the short course just fine now.

I'm still trying to be able to run it from a differently opened terminal, including from an XQuartz terminal (or from scripts) but I'm getting the error: 'get: command not found.' Below is what I did for each part of the instructions. Can someone please help me with where I'm going wrong? (If this part will be covered in the short course I can definitely wait!)

a) export GMTHOME=/Applications/GMT-6.1.0.app/Contents/Resources b) add $GMTHOME/bin to your path (my command - export PATH="$GMTHOME/bin:$PATH") c) export PROJ_LIB=$GMTHOME/share/proj d) export MAGICK_CONFIGURE_PATH=$GMTHOME/lib/GraphicsMagick/config

seisman commented 4 years ago

I'm getting the error: 'get: command not found.'

It's not clear to me why you have this error. What's the command you're running?

eraymondjames commented 4 years ago

'get' was a typo - sorry about that. The error is: "gmt: command not found"

Were the commands that used in a) to d) in my previous post correct or at least on track?

seisman commented 4 years ago

a) to d) are all correct, but

  1. did you add them to your ~/.bashrc file?
  2. what's the output of if you run echo $PATH?
eraymondjames commented 4 years ago

1) I didn't! Will the following work then? (Double checking so I wouldn't mess anything up.)

a) "export GMTHOME=/Applications/GMT-6.1.0.app/Contents/Resources:$PATH">>~.bashrc b) "export PATH="$GMTHOME/bin:$PATH"">>~.bashrc c) "export PROJ_LIB=$GMTHOME/share/proj d) export MAGICK_CONFIGURE_PATH=$GMTHOME/lib/GraphicsMagick/config">>~.bashrc

2) echo $PATH gives me - /Applications/GMT-6.1.0.app/Contents/Resources//bin:/Applications/GMT-6.1.0.app/Contents/Resources/bin:/opt/anaconda3/bin:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

p.s. Not sure why those lines are being crossed out once I submit my comment

seisman commented 4 years ago
  1. echo $PATH gives me - /Applications/GMT-6.1.0.app/Contents/Resources//bin:/Applications/GMT-6.1.0.app/Contents/Resources/bin:/opt/anaconda3/bin:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

I think it's OK. You should be able to run gmt since /Applications/GMT-6.1.0.app/Contents/Resources//bin is in your PATH.

PaulWessel commented 4 years ago

Let us know if things are working for you, @eraymondjames .

eraymondjames commented 4 years ago

Hello Paul,

Sorry for the late reply. I got everything up and running as needed for the short course but I'm still having issues with the other part to permanently add GMT to my PATH. I haven't been able to revisit troubleshooting this since my last message but I will be working on it as soon as I can and get back to you. For now, I'm good to go for the course. Thanks for following up.