How to make zsh run as a login shell on Mac OS X (in iTerm)?


When zsh is set as a login shell on Mac OS X, when it is started by iTerm, zsh doesn't consider that it's being run as a login shell, although it's started as ‘-zsh’ (‘-’ is put as the first character of arg[0]) which is supposed to mean that it should start as a login shell.

So, when I set the login shell to bash, bash recognizes this first ‘-’ in $0 and runs as a login shell, but zsh doesn't, although it seems that it should.

Is there a way to either make zsh recognize the ‘-’ in the arg[0], or make iTerm run the shell with a --login command line argument?

10/2/2015 10:03:47 PM

chsh -s $(which zsh)

You'll be prompted for your password, but once you update your settings any new iTerm/Terminal sessions you start on that machine will default to zsh.

2/18/2015 8:00:49 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow