“-bash: ls: command not found”

finderterminal

I installed the most recent update to OS X Lion (10.7). After I did that, my terminal won't recognize normal commands. I typed ls and got:

-bash: ls: command not found

I figured I'd try to add usr/bin to my path, but I can't find .bash_profile to edit it since typing edit .bash_profile won't work. I can't set the Finder to show all files since my terminal won't recognize the commands necessary to do that.

what do I need to do?

Best Answer

Since two commands are missing something “stomped” your path.

Before doing anything big, kicking off a backup might be prudent.

The default path on Mac OS X 10.7 (Lion) is something like this:

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

If you reset the path by typing the above into a shell window, and then typing export PATH it should manually let you test s local fix that window only.

This breakage is almost always something you need to fix in your dot files. For bash, edit and fix .bash_profile and/or .bashrc by undoing a recent change it just setting the $PATH you need again. The usual error is assigning a new path and not referring to the previous value of the variable on the right hand side of the =