How do I change $PATH and set it to the default directory?
First, check the contents of your ~/.profile
and ~/.bash_profile
for any lines involving writing paths to $PATH.
If this doesn't help, check the contents of /etc/paths
and /etc/paths.d/
for any path that you don't want to be included in your $PATH.
Furthermore, you can show what code is being run by bash by adding the following to the top of /etc/profile
:
set -x
Save the file, then open a new Terminal window. This should show when and how the $PATH variable is being overwritten.