How to delete old $PATH echo in Mac
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).
Related videos on Youtube
WaterWood
Updated on September 18, 2022Comments
-
WaterWood over 1 year
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.
-
Erdinç Taşkın over 9 yearsMay be this can help you, execute commands on '/' path. grep -R 'Users/WaterWood/eclipse/android-sdk-macosx/platform-tools' *
-
Admin over 9 years@ErdinçTaşkın Thanks for help, but i don't think grep all file in / is a good choice. I tried this before. It costs so much time(and just echo some useless information), so finally i canceled the operation.
-
Erdinç Taşkın over 9 yearsThis only execute to finding location of file, i mean, only 1 time is executed. To prevent execute useless information, grep -R 'Users/WaterWood/eclipse/android-sdk-macosx/platform-tools' * 2> /dev/null
-
anubhava over 9 yearsUse
bash -l -v |& WaterWood
when isWaterWood
being added -
mpy over 9 yearsPlease have a look at my answer superuser.com/a/772516/195224 where I outlined for zsh how to track down the source of a specific path element.
-
WaterWood over 9 years@janos Yes, i checked /etc/profile, /etc/bashrc, and all i know which may influence $PATH.
-
WaterWood over 9 years@mpy I use your method and checked all the file listed by
zsh -o sourcetrace
. Many of them are in .oh-my-zsh/. Only one weird file is/Users/majie/.zcompdump-waterwood-5.0.5:1>
(majie is my new username), I delete this file, but it doesn't work. -
WaterWood over 9 years@anubhava When i changed login shell from zsh to bash(in setting preference), everything is OK. That's weird. Maybe i should reinstall oh-my-zsh. Thank you.
-