from zsh document, ~/.zprofile
should only be sourced at login shell, and should NOT be sourced at every interactive session (for example, a new tab in a terminal).
- I am running MacOS Big Sur 11.2.3 (20D91).
But I can confirm that my ~/.zprofile
is sourced at every interactive session (a new tab). Why is that? Is this a bug? How to stop this incorrect behavior?
.zprofile
. If you then runzsh
in azsh
shell, you will come to the conclusion that it will not source.zprofile
again, but yes, new tabs and windows are login shells, not so much in Linux though. And MacOS behaves the same when you switch your shell to/bin/bash
. New terminal windows will always source.bash_profile
or.profile
, but unless tozsh
bash
will never source.bashrc
in login shells, so that's why.bash_profile
typically sources.bashrc
manually. – Martin Braun Jan 24 '24 at 10:50