A developer installed some Ruby gems on a new install of Ubuntu 10.10. After a few failures trying to run the gems, he realised that they failed because his PATH value did not contain the directory for the new gems.
He then executed the following command in his current shell;
PATH=$PATH:/path/to/gem
export PATH
When he echoed the PATH, he could see the modified PATH. But whenever he opened a new tab on the console, or restarted it, the changes were missing.
What did he do wrong?
PATH=$PATH:/path/to/gems
export PATH
only changes the environment for the current shell. Its good for testing.
Opening a new tab, or closing and reopening terminal creates a new shell with the old environment.
The lines must be added to ~/.profile , ~/.bash_profile or ~/.bashrc to change the environment for all of this user's shells.
To change the default PATH for all users globally you need to modify /etc/profile.