Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.