How to know why and where the $PATH env variable is set? - Unix & Linux Stack Exchange

PHOTO EMBED

Fri Feb 03 2023 13:57:08 GMT+0000 (Coordinated Universal Time)

Saved by @eneki

$ /usr/libexec/path_helper 
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:/Users/alan/.local/bin:/Users/alan/src/go/bin"; export PATH;
content_copyCOPY

ZSH has a built-in $PATH that it uses if nothing else is set, but that's not where yours is coming from. First of all there is a file, /etc/paths, that contains a list of directories. There is also a directory, /etc/path.d that contains more files that contain directories. The program /usr/libexec/path_helper takes these lists of directories, merges them with the existing $PATH variable (if there is one), removes any duplicates, and outputs the result, with the /etc/paths directories listed first.

https://unix.stackexchange.com/questions/246751/how-to-know-why-and-where-the-path-env-variable-is-set