When I run echo $PATH, my output is:
/usr/bin:/bin:/usr/sbin:/sbin But in my .zshrc, $PATH is commented out:
# If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH So, where is my PATH variable defined at? I am using oh-my-zsh, not sure if it has any difference from zsh.
2 Answers
There are many possibilities, but some are likelier than others. When starting Zsh, it will source the following files in this order by default:
/etc/zsh/zshenvUsed for setting system-wide environment variables. This file will always be sourced and cannot be overridden.$ZDOTDIR/.zshenvUsed for setting user's environment variables. This file will always be sourced./etc/zsh/zprofileUsed for executing commands at start, will be sourced when starting as a login shell./etc/profileThis file should be sourced by all Bourne-compatible shells upon login: it sets up $PATH and other environment variables and application-specific (/etc/profile.d/*.sh) settings upon login.$ZDOTDIR/.zprofileUsed for executing user's commands at start, will be sourced when starting as a login shell.$HOME/.profileis not sourced by zsh.
/etc/zsh/zshrcUsed for setting interactive shell configuration and executing commands, will be sourced when starting as an interactive shell.$ZDOTDIR/.zshrcUsed for setting user's interactive shell configuration and executing commands, will be sourced when starting as an interactive shell./etc/zsh/zloginUsed for executing commands at ending of initial progress, will be sourced when starting as a login shell.$ZDOTDIR/.zloginUsed for executing user's commands at ending of initial progress, will be sourced when starting as a login shell.
It looks as though the original value of PATH comes from /etc/paths.