michaelsanford
Translator, Web Developer
I was struggling for some time to come up with an efficient way to add custom folders to the shell $PATH that would be retained after logout.
This is the protocol I came up with.
1. With your favourite editor, create a file called ~/.path
2. In it, add lines of the format:
set path = ( $path /Path_you_wish_to_add )
You can either continue to add lines like this, or better, you can add to that single line every time you have a folder you want to add, separated by a space, with a space after ( and before ).
3. Add the following line to your ~/.tcshrc file (if you don't have one, create it):
source .path
Now, every time you log in, your custom path will be appended to your existing path.
You can change the search order by putting your own folders before or after the $path variable, but unless you have a good reason, don't.
NOTE: You should always add folders to your $PATH using the full path from root. So if you want to add ~/bin add it as /Users/username/bin
I feel this is the more elegant solution, especially if you have multiple-user system, than adding a 'set path = ( $path /custom_path )' in your '~/.login' file, but I suppose you can do that too.
This is the protocol I came up with.
1. With your favourite editor, create a file called ~/.path
2. In it, add lines of the format:
set path = ( $path /Path_you_wish_to_add )
You can either continue to add lines like this, or better, you can add to that single line every time you have a folder you want to add, separated by a space, with a space after ( and before ).
3. Add the following line to your ~/.tcshrc file (if you don't have one, create it):
source .path
Now, every time you log in, your custom path will be appended to your existing path.
You can change the search order by putting your own folders before or after the $path variable, but unless you have a good reason, don't.
NOTE: You should always add folders to your $PATH using the full path from root. So if you want to add ~/bin add it as /Users/username/bin
I feel this is the more elegant solution, especially if you have multiple-user system, than adding a 'set path = ( $path /custom_path )' in your '~/.login' file, but I suppose you can do that too.