1

OS: 14.4, shell: zsh, additional software: homebrew, vim, oh-my-zsh, iTerm2, et cetera

One day I noticed that my PATH contains strange part:

/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:Vim�UnDo�:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Apple/usr/bin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/Applications/Little Snitch.app/Contents/Components

The part is: ?Vim?UnDo? (actually there are UTF symbols instead of ?)

I grepped most parts of filesystem, home directory including files and directories starting with dot, /etc, /Library, /opt/homebrew for "UnDo", but found nothing.

It there a way to debug the process of changing PATH? Something like gathering trace or log of such changes or something like that?

1
  • Is the PATH broken in a freshly started shell, or is it correct first, but magically changes later on? Commented May 22 at 7:42

1 Answer 1

3

If it were statically added in zsh initialization it should be located in either ~/.z* or /etc/z*, and should have turned up in your manual search. If it is not in the zsh initialization files it is being added from an unexpected source.

Running zsh -x will (re)initialize zsh with XTRACE enabled and give you immense amounts of output of every command and initialization step being executed, and via what file or function.

1
  • 1
    Helped partially. With 'zsh -x' I was able to notice that it is path_helper sets PATH with strange component. Then I found its source in the internet. It turns out that it recursivly scans files hierarchy under /etc/path.d. And this directory contains binary backup file .100-homebrew.un~ which it tries to parse as a regular paths list. Commented May 22 at 23:30

You must log in to answer this question.

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