I was having a strange problem with PATH environment variable in MacOS that I spent several hours to debug:
Some time ago, when I was trying to fix the issue IntelliJ terminal PATH variable not the same with iTerm, I followed an online article and executed this:
sudo launchctl config user path $PATH
Apparently this command sets and persists the value of PATH variable at that moment of time somewhere and that variable is loaded even before my shell is loaded whenever I start a new zsh session. Only recently I recognized this issue because I removed some paths location setting in my
zshrc
and thePATH
variable still didn't reflectMy question is where does that command store the
PATH
variable value? and how does it load that value before my shell is loaded?
(For people who wonder how I fixed the issue: I executed the command again to set path to empty value: sudo launchctl config user path ''
)