Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Re-establishing ~/Library/init/tcsh functionality UNIX
Like many others, I was very surprised that OS X 10.2 seemed to break all my aliases and paths that I had so carefully setup according to Apple's recommendations in 10.1 -- I had created a folder in ~/Library/init/tcsh and stored path, aliases.mine and rc.mine there.

When I upgraded to 10.2, they all failed to work. After a bit of experimentation, I found that I could make everything work again by sticking it all in a .tcshrc file in my home directory. But this seemed less than elegant.

A bit more digging, however, revealed a very simple (and much more elegant!) solution. Read the rest of the article for the details...

It turns out that the files which used to live at:
have been moved to:
With this change in path, the startup scripts fail to read the ~/Library/init/tcsh files. The README file in the examples directory gives the simple solution:
This directory contains some useful tcsh files. In order to use this configuration:
 % echo "source /usr/share/tcsh/examples/rc"     > ~/.tcshrc
% echo "source /usr/share/tcsh/examples/login" > ~/.login
% echo "source /usr/share/tcsh/examples/logout" > ~/.logout
To do this system-wide, do the same instead to /etc/csh.cshrc, /etc/csh.login, and /etc/csh.logout.
Once I ran the three "source" commands, my previously defined prompt, shortcuts and paths were back to normal.

This might have been the most popular hint submission of the opening Jaguar weekend; I think I received variations on the above from at least five different people. So if I managed to get some of the details wrong, or you disagree with my methodology (hey, it worked for me!), please post your comments.
  • Currently 3.33 / 5
  You rated: 4 / 5 (3 votes cast)

Re-establishing ~/Library/init/tcsh functionality | 24 comments | Create New Account
Click here to return to the 'Re-establishing ~/Library/init/tcsh functionality' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Authored by: deleted_user18 on Aug 26, '02 01:13:35AM

~/bin is still not in my path. Any suggestions who this is done the correct way?

I heard a lot of things changed with environmet variables?


[ Reply to This | # ]
Authored by: macpoupou on Aug 26, '02 08:09:23AM

Open your ~/.tcshrc
And add a new line
setenv PATH "~/bin:${PATH}"

[ Reply to This | # ]
Authored by: paploo on Aug 27, '02 05:17:24AM

or, if you have the ~/Library/init/tcsh/ directory, create a file called environment.mine and make that same set line in it. These are, of course, both options that only work for your user. :)

[ Reply to This | # ]
Worked for me, THX
Authored by: skotmiller on Aug 26, '02 01:29:07AM

One Problem solved. I was affraid I lost the "l" directory listing.
I didn't like typing "ls -l" to get the same list.

So I'm lazy ;)


[ Reply to This | # ]
TERM_PROGRAM: Undefined variable?
Authored by: Robert on Aug 26, '02 02:02:33PM

I followed the instructions, but now I get a message \"TERM_PROGRAM: Undefined variable.\" when I log in by SSH. This did not happen in 10.1.

[ Reply to This | # ]
TERM_PROGRAM: Undefined variable?
Authored by: vajonez on Aug 26, '02 02:29:35PM
There is a typo in /usr/share/tcsh/examples/aliases. Change the line that says:
if ("$TERM_PROGRAM" == "Apple_Terminal") then
if ("$?TERM_PROGRAM" == "Apple_Terminal") then

[ Reply to This | # ]
TERM_PROGRAM: Undefined variable?
Authored by: Robert on Aug 26, '02 05:34:51PM

Thanks a lot! I hope someone at Apple reads this...

[ Reply to This | # ]
TERM_PROGRAM: Undefined variable?
Authored by: area51 on Sep 21, '02 01:23:14PM

It seems like this typo has been fixed in 10.2.1. I don't get an error when I open a terminal using Terminal but I still get the error message if I use XDarwin.

[ Reply to This | # ]
TERM_PROGRAM: Undefined variable?
Authored by: JohnAlbin on Sep 24, '02 02:03:36AM

I just installed a fresh 10.2.1 onto a new hard drive and this typo was not fixed like you said it was.

Perhaps you changed it before the upgrade and forgot?

[ Reply to This | # ]
TERM_PROGRAM: Undefined variable?
Authored by: jaacob on Mar 05, '03 01:56:47PM

So anyway, I'm running 10.2.4 and this typo still isn't fixed by default.


[ Reply to This | # ]
TERM_PROGRAM: Undefined variable?
Authored by: cilly on Aug 11, '03 01:29:12AM

This typo is not fixed in 10.2.6, too. You only get this error while logging in via ssh or X11. Not in a regular Terminal window.

Michael C. Haller

[ Reply to This | # ]
Restore .cshrc globally
Authored by: carsten on Aug 29, '02 09:23:20PM
The init.tcsh files were removed from their' old location (presumably) to keep in sync with other BSD implementations; this is a good thing. The real problem however, is with the csh initialization files in /etc, it looks like someone at Apple accidentally included the wrong /etc/csh.* files from a very old version of Darwin--either that or a very rash decision was made which breaks everyone's default shell and counters the decision to move the shell init files in the first place! ;-P If you did a clean install over top of an existing 10.1.5 installation, you can copy the three csh files from your "/Previous Systems/Previous System 1/private/etc" directory into /private/etc, replacing the ones which came with Jaguar. Alternatively you can run these commands in the terminal: (the first 2 lines just make a backup, if for some unique reason you want the Jaguar defaults back again) sudo mkdir /etc/csh-jaguar-defaults/ sudo cp -i /etc/csh.* /etc/csh-jaguar-defaults/ sudo sh -c 'echo "source /usr/share/tcsh/examples/rc" > /etc/csh.cshrc' sudo sh -c 'echo "source /usr/share/tcsh/examples/login" > /etc/csh.login' sudo sh -c 'echo "source /usr/share/tcsh/examples/logout" > /etc/csh.logout' If you use both a .cshrc and a .tcshrc, you might have to include an extra line in your .tcshrc to get both to work properly (I think tcsh is supposed to use both rc files since tcsh is considered a "c shell", but it doesn't use .cshrc anymore on my system since upgrading to Jaguar): source ~/.cshrc

[ Reply to This | # ]
ok but
Authored by: macubergeek on Aug 30, '02 07:51:40PM

I followed these instructions and blew away my aliases in .tcshrc
I started with this /Users/jamesk/Library/init/tcsh/path file:

setenv PATH ${PATH}:/Users/jamesk/bin/powerpc-apple-darwin:/Users/jamesk/scripts
setenv MANPATH ${MANPATH}:/Users/jamesk/man:/usr/local/share/man:/usr/share/man:

Following the instructions I blew away my original .tcshrc file with alot of aliases so I recreated it and simply sourced the /Users/jamesk/Library/init/tcsh/path file
the PATH variable was properly set but NOT the MANPATH variable.

where do I set the MANPATH variable? In what file?

[ Reply to This | # ]
Authored by: lucas_mbase on Sep 27, '02 02:02:50AM
I know this thread is kind of old but...

Try rearranging your 'setenv' line, it could be that tcsh is balking at the ${MANPATH} prefix and is not setting the environment properly. Try putting your user paths first like this:

setenv MANPATH /Users/jamesk/man:/usr/local/share/man:/usr/share/man:/sw/share/man:/usr/X11R6/man:${MANPATH}

Related reading:
man tcsh
man man
man manpath
Also, take a look at the file /etc/manpath.config for adding common paths.

[ Reply to This | # ]
ok but
Authored by: rtilley on Oct 10, '02 04:38:12AM

see "man manpath"

[ Reply to This | # ]
Terminal messed up.
Authored by: pjr on Sep 12, '02 12:00:33PM

I'm fairly new to Unix, and had really just started using the aliases.mine, so followed this procedure to get it back on my iBook, which worked fine, but on my Cube it didn't work. I don't remember doing anything different. My terminal now loads up, and in every new window just says:

Last login: Thu Sep 12 16:44:43 on ttyp3
Welcom to Darwin!
[Process Completed]

I can only run commands individually from File:New command.. How can I get it to work again? Any help would be great.


[ Reply to This | # ]
Terminal messed up.
Authored by: bluehz on Sep 13, '02 12:14:51AM

Paul - I don't know the solution to your problem, but I can tell you I have been stumped more than once with odd behaviour like this - not exactly what you are getting - but odd nevertheless. I have always found that its usually a syntax error in one of my files. I am real bad about leaving off the closing single-quote on my aliases and that tends to cause some oddities. Problem is you can;t track the problem down so easy. I would suggest you go back into the last few term type files you edited and double check your syntax - dot your i's, etc. If you aren't real strong in recognizing a syntax error then just comment out (place a # at the start of each line) the new stuff you added and slowly add it back in a little at a time. Eventually you will enable just the line that causes the problem and then you can zero in on the solution. Hope that helps.

[ Reply to This | # ]
Terminal messed up -- solved!
Authored by: Andrew LaGow on Sep 15, '02 08:52:53PM

I was getting that error too. I finally figured it out.

You're going to have to delete the duplicate *.mine files in ~/library/init/tcsh. This is only true if these files duplicate the information in usr/share/tcsh/examples that is pointed to either in your ~/.tcshrc file or on a global scale as in the above example in your /etc/csh.chsrc file.

I'd also think that if ~/Library/init/tcsh/login.mine and ~Library/init/tcsh/logout.mine are duplicates of /etc/csh.login and /etc/csh.logout then you'll also have problems.

One other thing. It's okay to have the ~/Library/init/tcsh files, but they can't duplicate the contents in those other directories.

[ Reply to This | # ]
Terminal messed up -- solved! -- Confirmed!
Authored by: pjr on Sep 21, '02 08:25:13PM

Hey thanks for your replies, and fixing my problem. Great job!

[ Reply to This | # ]
Fink problems
Authored by: lngtones on Sep 16, '02 04:43:09PM

Ok, how do you get fink to work with this situation?

I\'ve added

source /sw/bin/init.csh

In .cshrc explicitly sourced from .tcshrc

I\'ve put it in .tcshrc

I\'ve put it in rc.mine

I\'ve put it in aliases.mine

yet it doesn\'t run it when I start a new session

fink will not be in my PATH

however, then I type on the command line:

source /sw/bin/init.csh

and everything works fine

why won\'t it run automatically?

[ Reply to This | # ]
Fink problems
Authored by: matt02 on Nov 13, '02 12:18:12AM

I don't know if anyone's still reading this, but the solution I found is to put 'source /sw/bin/init.csh' at the end of your .login file rather than your .cshrc file.

The reason is that the /usr/share/tcsh/examples/login script, which you sourced in your .login, sets the path and is called AFTER your .cshrc or .tcshrc. Thus it overwrites the path to Fink with the standard system paths.

When you source the init.csh file on the command line, of course it works, because the shell doesn't look at .login. It's a different story when you actually do log in again. So put your path to Fink at the end of your .login or in your ~/Library/init/tcsh/login.mine.

[ Reply to This | # ]
Fink problems - SOLVED!
Authored by: by on Nov 24, '02 07:51:46AM

I finally found the culprit:
.login branches to /usr/share/tcsh/examples/login where the path is set explicitely, so everything that's been sourced before is deleted...
If you comment it out
everything works (again) as expected.

The question is now what am I missing by bypassing /usr/share/tcsh/examples/login...???

Best regards,

[ Reply to This | # ]
easy way
Authored by: clubphilly on Jan 21, '03 04:33:24PM

just delete the setenv .... which you have already defined somewhere else from the /usr/share/tcsh/examples/login file.. it's programming, not magic.

[ Reply to This | # ]
Command not found error
Authored by: bgitac on Oct 24, '02 01:12:20AM

I added the /sw/bin and /sw/sbin paths to my tcsh login file and echoed it over to my home directory. I also fixed the spelling error mentioned. However, when I try to run anything in /sw/bin or /sw/sbin in Xfree86 I'm asked if I want to run .program. If I say yes then it says that it doesn't exist. Has anyone had similar problems?

[ Reply to This | # ]