I have just installed zsh on my Mac (OS X 10.15.2 Catalina), and now am trying to get it working right on a computer running Mint 19.3. The Mac has shared bash startup files with the Linux computer (via the unison app), and I am trying to maintain that sharing capability with the zsh startup files.

The problem is that under the Linux zsh (5.4.2), .zprofile gets executed for interactive shells, but it does not get invoked for login shells that are not interactive. According to

What should/shouldn't go in .zshenv, .zshrc, .zlogin, .zprofile, .zlogout?

and other references, .zshenv is sourced for every shell, .zshrc is sourced for only interactive logins, and .zlogin is supposed to be sourced for all login shells. I have put commands into .zlogin that should be executed for any login shell, whether interactive or not. On the Mac, this configuration works as expected, but on the Linux computer, .zlogin and .zprofile are executed if the login is through ssh, but not when logging in through the GUI (specifically, after booting the computer, and providing login and password through GUI widgets, then choosing the Terminal app). My computer setup requires commands that are executed upon every login--ssh (specifically, using previously established ssh keys and credentials) as well as interactive logins--but not for non-login shells.

Maybe the problem here is just my interpretation of the definitions of the types of shells involved, but in any case, how can these behavioral differences between the two OSs be reconciled?

  • You should explain in the question why you think that the shells that you are running under a GUI terminal emulator are login shells. – JdeBP Jan 28 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.