Setting up execution path in Terminal

bashpathterminal

I have no experience with using Terminal but I am trying to install a program msbayes
(installation instructions here.

The instructions say to set up an execution path using either

$ echo 'export PATH=$PATH:$HOME/bin' >> ~/.bash_profile

Or

$ echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bash_profile

I have tried both of these but am still getting a command not found response. What am I doing wrong? Any advice?

Best Answer

Are you copying the dollar sign into terminal? The dollar sign in writing, like in the document, is just a sign that it is on a new terminal line.

You can copy and paste these commands into terminal and it should work. I just tried it on my machine

echo 'export PATH=$PATH:$HOME/bin' >> ~/.bash_profile

or

echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bash_profile

Then you can verify that they have worked by typing in this command

cat ~/.bash_profile

And you should see

export PATH=$PATH:$HOME/bin

or

export PATH=$PATH:/usr/local/bin

Depending on which one you used.

If you want the changes to also be applied to the currently running shell, you need to run

. ~/.bash_profile

as well.

Related Question