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

bashmacosshellzsh

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?

Best Answer

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.