使用 Zsh 启动 iTerm2

我一直在研究 iTerm2的设置,但我似乎找不到一种方法来让它启动 Zsh 而不是 Bash,有人知道在 iTerm2中这样做的正确方法吗?

我问这个问题是因为我来自 Mac Terminal,它很容易让你选择在启动时运行什么,但我似乎找不到 iTerm2直接的东西。

我在谷歌上搜索了它,但由于某种原因,我只能找到 oh-my-zsh 引用,没有任何与未修改的 iTerm2相关的内容。

我很感激你能提供的任何帮助,谢谢。 :)

86725 次浏览

Change your default shell to /bin/zsh by running the chsh -s /bin/zsh command.

Although the change with chsh -s $(which zsh) worked perfectly for me, my iTerm2 wouldn't automatically open new terminals with zsh.

Instead I went to iTerm2 -> Preferences -> Profiles -> Default and in the General Tab set the Command to /usr/local/bin/zsh instead of Login shell.

Update: With the current version of iTerm (as of 2.1.1) it perfectly worked for me by changing the default shell (shown above) only.

Similar to above answer: Editing my zsh profile that I created, on General tab, in the "Send text at start:" field, I have "clear; pwd; ls; zsh;" this leaves me with a window showing me what I want to see and lastly starting zsh.

The following also worked for me:

Preferences -> Profiles -> General Tab -> Command -> Choose "Custom Shell" -> write "zsh"

Restart iTerm2.

I still keep bash for Terminal as the default shell.