3

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

8
  • May be this can help you, execute commands on '/' path. grep -R 'Users/WaterWood/eclipse/android-sdk-macosx/platform-tools' * Dec 26, 2014 at 6:45
  • @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.
    – WaterWood
    Dec 26, 2014 at 6:53
  • This 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 Dec 26, 2014 at 7:45
  • 2
    Use bash -l -v |& WaterWood when is WaterWood being added
    – anubhava
    Dec 26, 2014 at 8:08
  • Please 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.
    – mpy
    Dec 26, 2014 at 13:24

2 Answers 2

1

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).

-1

type

sudo pico /etc/paths

in terminal , you can the old path just edit and press

ctrl+O

and hit enter and at last

ctrl+x

now echo $PATH and see

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .