Error message on Terminal launch [duplicate]

You have recently edited one of your shell’s startup files and introduced an error.

Probably, ls -lart ~/.bashrc ~/.bash_profile ~/.profile will indicate which one — if one or more is missing, that’s no concern, we just want to see which one out of these you have edited recently. Examine the time stamps and try to remember what you did to change one of these files.

The error probably looks something like

$oopsPATH=/usr/local/bin:$PATH

where you meant to say

PATH=/usr/local/bin:$PATH

but without access to your files, we can’t know what exactly is supposed to be there, or how you messed it up.

See also https://askubuntu.com/questions/198730/how-to-restore-bashrc-file/198740#198740

In the common case where you have messed up your PATH so that ls and other commands are unavailable (bash: ls: command not found), you can use the full path (/bin/ls pro ls, etc; though obviously, you have to know the correct path) at least until you can restore your configuration.

PATH=/usr/local/bin:/usr/bin:/bin

is probably a good crutch until you can find the correct default for your OS. You can type that at the prompt, or put it in one of your shell’s startup files and start a new shell.

On many platforms, you can find the default user dot files in /etc/skel so if that’s present (which unfortunately will not be true for Mac OS, but should be there on most Linuxes):

 cp -b /etc/skel/.bash_profile $HOME/

will replace your (presumably broken beyond repair) .bash_profile with the system default one. (Omit the -b option if your OS doesn’t have it, but then you’ll want to back up your file manually before replacing it.)


Update: This fragment near the top of your .bash_profile is erroneous:

#loginPath
=/usr/local/bin:$PATH

Just take it out; it doesn’t seem to do anything useful. There seem to be multiple additional fragments from the MacPorts installer which look wrong, too, but they are just comments. (Perhaps somehow they shouldn’t be?)

Leave a Comment