image
image

Go Back   macosx.com > Mac Help Forums > HOWTO & FAQs

Reply
 
Thread Tools
  #1  
Old February 20th, 2003, 09:15 PM
michaelsanford's Avatar
Psycholinguist
 
Join Date: Oct 2002
Location: Ottawa/Montrιal
Posts: 2,172
Thanks: 0
Thanked 0 Times in 0 Posts
michaelsanford is on a distinguished road
[HOW TO] Preserve a custom shell $PATH after logout.

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.
__________________
michaelsanford.com • Blog • Twitter • Tumblr • LinkedIn
• iMac Aluminum 24" |
MacOS X 10.5-current | 3.06 GHz Intel Core Duo | 4 GB RAM | 1 TB HDD
• iBook G4 1.42 GHz | MacOS X 10.5-current | 1 GB RAM, 100 GB HDD
• AMD Athlon64 3500+ | Slackware 12 (2.6.21.5-smp) | 2 GB RAM, 2•120 GB RAID 1, 2•500 GB RAID 0

Last edited by michaelsanford; February 20th, 2003 at 09:28 PM.
Reply With Quote
  #2  
Old February 20th, 2003, 09:35 PM
~departed~
 
Join Date: Jul 2002
Location: Kansas City, MO
Posts: 457
Thanks: 0
Thanked 0 Times in 0 Posts
gatorparrots is on a distinguished road
Here is a standard way of adding to your PATH:
echo 'setenv PATH "${PATH}:/usr/local/bin:/Developer/Tools:/some/other/path"' >> ~/.tcshrc
source ~/.tcshrc
to have it effective immediately.

You can add it manually with a text editor if you like. As an alternative, you could choose to add it to ~/Library/init/tcsh/path.mine instead of your .*cshrc file, but I prefer to have everything in one compact file for easy backup, portability, and migration from one system to another.
Reply With Quote
  #3  
Old February 21st, 2003, 10:35 AM
michaelsanford's Avatar
Psycholinguist
 
Join Date: Oct 2002
Location: Ottawa/Montrιal
Posts: 2,172
Thanks: 0
Thanked 0 Times in 0 Posts
michaelsanford is on a distinguished road
I thought the path file was the only one that didn't take a .mine (so ~/Library/init/tcsh/path )?

I tried that first, and I get errors every time I logged in, so I had to do this instead...

I certainly see how you can prefer to have everything in one file; I prefer multiple files myself but that's just me
__________________
michaelsanford.com • Blog • Twitter • Tumblr • LinkedIn
• iMac Aluminum 24" |
MacOS X 10.5-current | 3.06 GHz Intel Core Duo | 4 GB RAM | 1 TB HDD
• iBook G4 1.42 GHz | MacOS X 10.5-current | 1 GB RAM, 100 GB HDD
• AMD Athlon64 3500+ | Slackware 12 (2.6.21.5-smp) | 2 GB RAM, 2•120 GB RAID 1, 2•500 GB RAID 0
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[HOW TO] Terminal berniech Unix & X11 8 February 24th, 2003 02:26 PM


All times are GMT -5. The time now is 05:58 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.