I was trying to add something to $PATH and it went totally wrong. I now can't run any commands such as ls
. I've looked at this answer (https://apple.stackexchange.com/questions/11745/reset-your-path-variable) and used the following lines:
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
PATH=$PATH:~/bin
These lines fix the problem temorarily; however, when I restart terminal it seems to forget these changes.
How do I permanently reset my $PATH?
I'm running the most recent version of Mountain Lion.
Thanks
Best Answer
You obviously have a malformatted line somewhere in one of your shell configuration files that are read when the Terminal starts Bash. This is either
.profile
or.bash_profile
, depending on which you used. In OS X,.bashrc
isn't read unless you've explicitly sourced it from one of these other files.To be able to use the commands without setting a
$PATH
, simply call them by their full location.If you know that there's nothing else in the files you need, delete them:
If not, open them in TextEdit, for example, and remove the offending lines with
PATH=
:If you'd like to use a command line editor, you can do that as well: