How can I reset my bash configuration?

When I open Terminal it shows this:

Last login: Fri Apr 1 17:04:59 on ttys000
-bash: export: /opt/local/bin': not a valid identifier
-bash: export::/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/usr/local/git/bin:/usr/X11/bin': not a valid identifier
Josh@Macbook-Pro~$ export

I installed something yesterday and modified bash_profile. Now I cannot do anything in Terminal. Even "ls". It returns…

bash: ls: No such file or directory

How can I fix it?


Sounds like it's screwing up your PATH, so the shell can't find any of the usual commands. In this case, you can still use the commands by specifying their entire path (e.g. /bin/ls instead of just `ls), or just reset your PATH manually:

PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin:/usr/local/git/bin:/usr/X11/bin

(Note that that's based on the error you gave; there may be some directories missing.)

If .bash_profile is the only thing messed up, it's probably easiest to just disable it:

/bin/mv .bash_profile bash_profile_disabled
/bin/mv .bashrc bashrc_disabled

... and then open a new (clean) Terminal window, and then look through the file to see if you can undo the damage before renaming it back.