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?

link|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
feedback

2 Answers

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.

link|improve this answer
feedback

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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