Much of this depends on the setup you have done in ITerm and setting up shells.
By default iTerm runs the shell in /etc/passwd as a login shell. By default the shell is bash but the user has changed this to zsh
zsh has several files that are used at startup see zsh manual $ZDOTDIR is by default your home directory
Commands are first read from /etc/zshenv; this cannot be overridden.
... ...
Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login shell, commands are read from /etc/zprofile and then $ZDOTDIR/.zprofile. Then, if the shell is interactive, commands are read from /etc/zshrc and then $ZDOTDIR/.zshrc. Finally, if the shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.
So when items starts a login shell (and assume no global files in /tc) the following files are sourced
/etc/zshenv
~/.zshenv
~/.zprofile
~/.zshrc
~/.zlogin
If zsh is started from a shell prompt it is not a login shell and so only the following are read
/etc/zshenv
~/.zshenv
~/.zshrc
If you get different behaviour in the two cases then look at your ~/.zprofile and ~/.zlogin .
In this case one of them probably is sourcing ~/.zshrc. Note that this differs from bash where a login shell reads ~/.bash_profile and a non login shell reads ~/.bash_profile and this the normal bash use is to source ~/.bashrc in ~/,bash_profile so to stop the need to duplicate code.
Best Answer
I've just added
to the file
and solved the issue