How to reset $PATH?


The suggested answer of removing .bash_profile is not a good idea in general. There are other things that can be set in that file besides PATH definitions.

If you want to undo the effects of your experimentation, just remove or comment out that PATH line with a #.

You don’t want to edit the PATH from scratch, but append to it, as you did with your second line. The preferred method of adding something to your path would be:

export PATH=$PATH:$HOME/bin

EDIT Since your PATH is messed up, you don’t have access to the usual commands to make these changes. As a temporary fix, you can define a new minimal path in a Terminal window (not in your .bash_profile) by typing:

PATH=/bin:/usr/bin

This will temporarily give you access to nano ls mv vi cat and rm — the basic tools to check and edit your .bash_profile and fix your problem…

Repeat, do not put this PATH definition anywhere except for the duration of the session while you make your fixes.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.