Where can I add something to my PATH?

There are two ways to do this. In a shell you may type ‘setenv PATH ~/bin:$PATH’. This would add the directory ~/bin to your path.

The other way is to add the path to your .tcshrc (or other shell’s rc file).  Open your .tcshrc in your favorite text editor (ie, vim .tcshrc) and add this line:

setenv PATH $:~/bin

Again, this will create a path to your bin directory inside your home directory.  Also, when using this method, the variable will not become active untill you open up a new shell or run ‘source .tcshrc’.

bash/zsh

To add to the PATH environment variable temporarily in bash or zsh, you may type “export PATH=<newpath>:PATH” where <newpath> is the path you want to add.

To change your PATH permanently in bash or zsh, add the path to your .bashrc or .zshrc. Open .bashrc or .zshrc in your favorite text editor (ie, nano .zshrc) and add this line:

PATH=<newpath>:$PATH

Where <newpath> is the path you want to add.

Posted in: Unix