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

You must log in to answer this question.

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