Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to add the path to the compiler to the $PATH variable. To do this I add the line

$ export PATH="$PATH:actualpathhere"

to the ~/.bash_profile file. Now when I open another terminal and try to build my code it doesnt work. If I do echo $PATH in the new terminal it doesnt show the correct path. I am confused as to why this is happening. I use a Mac (Snow leopard) and the terminal uses bash.

share|improve this question
did you try running : source .bash_profile? – llazzaro Jul 14 '11 at 22:49
yes it says command not found – Manish Jul 14 '11 at 23:07
up vote 3 down vote accepted

When you enter the line in your bash_profile, there should be no $ before the export.

$ export PATH="$PATH:actualpathhere"

This alone would be correct:

export PATH="$PATH:actualpathhere"

$ designates the prompt from the shell itself, so in some online tutorials you will find it in front of commands that you should manually enter. You will however never have to enter the $.

Going with bash_profile on OS X is okay, because it is loaded whenever a Terminal window is opened. This isn't really the case for other operating systems or terminals, so it'd be possible to put the variables into ~/.bashrc and call source ~/.bash_profile from there.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .