Macos – How to delete old $PATH echo in Mac

bashmacospathzsh

After i changed my Mac username(using the way supplied by Apple Documents), I found that when echo $PATH, there are some old paths in it.

/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/Cellar/tomcat/7.0.42/bin:/Users/WaterWood/eclipse/android-sdk-macosx/platform-tools/:/Users/majie/.rvm/bin

WaterWood is my old username and not exists anymore(I also deleted the folder "/User/WaterWood")

I checked all configuration file, such as .bashrc, .bash_profile, .zshrc, /etc/paths, /etc/paths.d/, but found nothing with "/User/WaterWood".

How to delete these from my $PATH? Thanks.

================

Update:

First I thought it was some bug of oh-my-zsh, and I reinstalled it. It works well, but when i re-login the problem appears again.

Change system shell to zsh(in system preference), run /usr/libexec/path_helper(the result is wrong)

PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/Cellar/tomcat/7.0.42/bin:/Users/WaterWood/eclipse/android-sdk-macosx/platform-tools/:/Users/majie/.rvm/bin"; export PATH;

Change system shell to bash, run path_helper(the result is correct)

PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"; export PATH;

I delete all specific configuration in home folder(.zshrc, etc), but also has a "waterwood" in my terminal window, that drives me crazy.

enter image description here

Best Answer

Check this link if you're facing the same problem.

Default configuration file depends on which shell you're using. Back to my question, I forgot to check ~/.zprofile("waterwood" is set in this file).