zsh problems MacOS High Sierra

Sriranga Veeraraghavan sriranga at berkeley.edu
Tue May 3 04:49:45 UTC 2022


> On May 2, 2022, at 20:46, Ryan Schmidt <ryandesign at macports.org> wrote:
> 
> ...
> 
> When the MacPorts installer detects that your shell is zsh, it places such a line in ~/.zprofile. I don't know if there is a significant difference between putting it in ~/.zprofile vs putting it in ~/.zshenv.
> 

I am not a zsh user, but according to zsh's documentation, ~/.zprofile is run only when zsh is used as a login shell, whereas ~/.zshenv is read for nearly every instance of zsh (including scripts):

https://zsh.sourceforge.io/Guide/zshguide02.html#l9

Because of this, it is possible that if /opt/local/bin, etc., are only added to PATH in ~/.zprofile, then in some instances zsh would use the Apple standard programs in /bin, /sbin, /usr/bin, etc., while in other instances zsh would use, for example, the MacPorts versions in /opt/local/bin, etc.  This might lead to inconsistencies or hard to detect bugs in shell scripts, etc. 

Best,

-ranga




More information about the macports-users mailing list