My $PATH has gone awry

Posted:
in Genius Bar edited January 2014
I installed fink as per the instructions, but when I tried to add the "source /sw/bin/init.csh" line to my .cshrc file it gave me an error upon opening a new terminal window (PATH didn't change either). I then removed the .cshrc file from my user folder, and deteted fink (sudo rm -rf /sw). However, now whenever I log in, PATH is incorrectly set. According to csh.login it should be: "/bin:/sbin:/usr/bin:/usr/sbin:/Applications/STk/bin"



however, now, it is: "/usr/bin:/bin:/usr/sbin:/sbin:/Volumes/iMac HD/Users/nprasad"



Where could it be changing PATH? I don't know of any other file that tcsh loads at login (that messes with PATH), and I'd appreciate any help at getting my PATH set correctly again. Thank you in advance!



Blueflame



[ 12-19-2002: Message edited by: Blueflame ]</p>

Comments

  • Reply 1 of 3
    i'm not absolutely certain, but i think tcsh first goes to /etc/csh.cshrc and to /etc/csh.login, for the login script. then one of those calls ~/.tcshrc, and lacking that, it calls ~/.cshrc [where ~ == $HOME]. i wrote my .tcshrc, so i dont remember what is supposed to happen in it, or what files it originally called.



    but, thats all unnecessary. if u want to change your $PATH, you can inside your .tcshrc [or .cshrc if u dont want to have a .tcshrc]. make one of the last lines in it:

    [code]setenv PATH "/bin:/sbin:/usr/bin:/usr/sbin:/Applications/STk/bin";</pre><hr></blockquote>



    now, i should mention that its generally, i think, better to only add onto the path, and not clobber it. so instead of the above, i suggest:

    [code]setenv PATH "/new/additions:/second/addition:$PATH";</pre><hr></blockquote>

    and replace "/new/additions" with a folder containing executables, and "/second/addition" to another folder of executables. dublicate entries in the $PATH don't really cause problems, so re-adding /bin or /sbin won't really cause trouble. the only issue i could really think of, is the shell checks the PATH left to right, so if /bin is first, and /Applications/STk/bin is second, and you have a program called "foo" in both, then the version in /bin will get executed and not from /Applications/*.



    also, if i had to guess, i wouldn't really think that it was any part of the regular tcsh startup that was adding the /Volumes/* onto ur path, probably somethink linked in from your ~/.tcshrc.
  • Reply 2 of 3
    Thank you for the excellent solution! I edited the .cshrc file for all the accounts so now the $PATH is set correctly. However, as far as I can tell, none of the csh.* files in either /private/etc or /etc have changed from the original setting (/bin:/sbin:/usr/bin...blah blah). I'm still curious to know what was changing PATH to what it was (I don't have a .tcshrc file in any account, and .cshrc didn't exist until a minute ago). The /Volumes/* is the path to my home folder (I moved it from the system partition to another larger partition through Netinfo).



    Thanks!



    Blueflame
  • Reply 3 of 3
    [quote]Originally posted by thuh Freak:

    <strong>...

    now, i should mention that its generally, i think, better to only add onto the path, and not clobber it.

    ...</strong><hr></blockquote>



    You should be careful doing this.



    Every childs $PATH will have the additional path added multiple times. This not only makes the search for things unnecessarily longer and longer but also can cause the "Warning: ridiculously long PATH truncated" message.
Sign In or Register to comment.