zsh problems MacOS High Sierra

Ryan Schmidt ryandesign at macports.org
Tue May 3 05:23:15 UTC 2022


On May 2, 2022, at 23:49, Sriranga Veeraraghavan wrote:

> On May 2, 2022, at 20:46, Ryan Schmidt 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. 

MacPorts has been modifying ~/.zprofile when the shell is zsh ever since zsh support was added to MacPorts 2.5 years ago. If it is a problem, nobody has reported it so far.

https://github.com/macports/macports-base/commit/f9a3b2d5bcc27a1a279184c496a095f31b5d85a2

All shells on macOS are login shells.



More information about the macports-users mailing list