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 installed a few Ruby gems on a new install of Ubuntu 9.10, and after a few tries at running one, I realized that they failed because the PATH value did not contain their locations. SO I used the following command:

PATH=$PATH:/path/to/gem
export PATH

When I would echo the PATH, I would see my change in there. But when I opened a new tab on the console, or restarted it, my changes are gone.

I'm not sure what is the problem. Can anyone shed some light on it please?

share|improve this question
    
the answer to this similar question should help: superuser.com/questions/73097/… .. see also superuser.com/questions/112710/… –  quack quixote Mar 4 '10 at 13:03

2 Answers 2

up vote 3 down vote accepted

The commands you show alter the PATH for the command shell in which they are run. When you open a new console tab or terminal window, you start a new shell.

In order to alter your PATH for every shell instance, you need to put those two lines in your ~/.bashrc file so that they get executed every time you start a new shell.

share|improve this answer

PATH=$PATH:/path/to/gem export PATH

That change environment only for child ptocess. Its good for testing.

For example

xterm&

For permanent effect on current user, change in ~/.profile or ~/.bash_profile For system global effect change /etc/profile

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.