How to set my $PATH variable to defaults

LoneLizard

Registered
Hi,

I use the command line a lot in OS X (running Snow Leopard, 10.6.8) and for some reason or other now, I cannot run simple commands like ls or rm without putting /bin/ in front of them. This would be the output if I tried to do so:

dyld: Library not loaded: /usr/local/lib/libintl.8.dylib
Referenced from: /usr/local/bin/ls
Reason: image not found

My $PATH is a dog's breakfast:

/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/MacGPG2/bin:/usr/X11/bin

I've had Fink and MacPorts but I recently removed them both because they turned out to be more trouble than they were worth. This, however, might have left some damage to the $PATH variable.

What can I do to fix this? I just want to be able to use normal shell commands. How can I set the $PATH to my factory defaults and make it just plain work?

Thanks
 
Are you using BASH? Look at two files in your home directory: .bashrc and .bash_profile

Yes, the names both start with dot, and they are both shell scripts. Pay attention to the settings for PATH.

Installing MacPorts alters .bash_profile. Maybe now it's in a weird state, after you removed the software.
 
The shell I am using is tcsh. I confirmed that with the echo command.

I just did a /bin/ls -Flai in both my root directory and my home directory; and there is no such file of which you speak; neither for BASH, nor for tcsh.

Am I looking in the wrong places?
 
How about .tcshrc? In a terminal window, enter "/usr/bin/man tcshrc" and look at the output, especially

Startup and shutdown
A login shell begins by executing commands from the system files /etc/csh.cshrc and /etc/csh.login. It then executes commands from files in the user's home directory: first ~/.tcshrc (+) or, if ~/.tcshrc is not found, ~/.cshrc, then ~/.history (or the value of the histfile shell variable), then ~/.login, and finally ~/.cshdirs (or the value of the dirsfile shell variable) (+).​
 
Result:

Code:
No manual entry for tcshrc

That having been said, this is the content of the ~./.cshrc file:

Code:
set path = (/usr/local/bin $path)
source /sw/bin/init.csh
set path=(/ope/local/bin $path)
 
Last edited:
Here is what I got:
Code:
Startup and shutdown
       A  login  shell  begins  by  executing  commands  from the system files
       /etc/csh.cshrc and /etc/csh.login.   It  then  executes  commands  from
       files  in  the  user's  home  directory:  first  ~/.tcshrc  (+)  or, if
       ~/.tcshrc is not found, ~/.cshrc, then ~/.history (or the value of  the
       histfile shell variable), then ~/.login, and finally ~/.cshdirs (or the
       value of  the  dirsfile  shell  variable)  (+).   The  shell  may  read
       /etc/csh.login  before  instead  of  after /etc/csh.cshrc, and ~/.login
       before instead of after ~/.tcshrc or ~/.cshrc  and  ~/.history,  if  so
       compiled; see the version shell variable. (+)

       Non-login  shells read only /etc/csh.cshrc and ~/.tcshrc or ~/.cshrc on
       startup.

       For examples of startup  files,  please  consult  http://tcshrc.source-
       forge.net.

Commands  like  stty(1)  and  tset(1),  which need be run only once per
       login, usually go in one's ~/.login file.  Users who need  to  use  the
       same  set  of  files with both csh(1) and tcsh can have only a ~/.cshrc
       which checks for the existence of the tcsh shell variable (q.v.) before
       using  tcsh-specific  commands,  or  can  have  both  a  ~/.cshrc and a
       ~/.tcshrc which sources (see the builtin command) ~/.cshrc.   The  rest
       of  this manual uses `~/.tcshrc' to mean `~/.tcshrc or, if ~/.tcshrc is
       not found, ~/.cshrc'.

       In the normal case, the shell begins reading commands from  the  termi-
       nal,  prompting with `> '.  (Processing of arguments and the use of the
       shell to process files containing command scripts are described later.)
       The  shell  repeatedly  reads  a  line of command input, breaks it into
       words, places it on the command history list, parses  it  and  executes
       each command in the line.

       One can log out by typing `^D' on an empty line, `logout' or `login' or
       via the shell's autologout mechanism (see the  autologout  shell  vari-
       able).  When a login shell terminates it sets the logout shell variable
       to `normal' or `automatic' as appropriate, then executes commands  from
       the  files  /etc/csh.logout  and  ~/.logout.  The shell may drop DTR on
       logout if so compiled; see the version shell variable.

       The names of the system login and logout files vary from system to sys-

None of this tells me how to fix this problem, however. It doesn't seem like what I am asking is very complicated: all I want to do is set the command line to factory defaults. That's it.
 
I think you need to do two things (as a minimum): reset your terminal settings to defaults, which is what happens when you remove the com.apple.Terminal.plist file from YOUR user/Library/Preferences folder.
I also think that you would then want to make sure the $PATH file is correct to original defaults, so that terminal commands will work properly (hopefully). It would also make sure that any shell scripts work as reliably as they may be created. Here's a good site that can help you with a lot of terminal/Unix usage: http://hayne.net/MacDev/Notes/unixFAQ.html#executionPath

The terminal reset should also set the shell to the default bash. As most scripts use bash, that may be a better choice, until you get more comfortable with unix, etc.
 
Deleting the com.apple.Terminal.plist was easy. I did that. Then I changed the default shell in the Terminal Preferences to /bin/bash and now all standard commands work. I'm pleased. :)

Thank you everyone!
 
Back
Top