Change tmux default to zsh

You probably want zsh to be your default shell for most things, then (but this will not apply to cron). The following will make zsh your default shell, and you should then not need to tell tmux anything.

chsh -s /usr/bin/zsh

Note that some OSs still use /bin/zsh as the path to zsh.


From man tmux:

default-shell path
Specify the default shell. This is used as the login shell for new windows when the default-command option is set to empty, and must be the full path of the executable. When started tmux tries to set a default value from the first suitable of the SHELL environment variable, the shell returned by getpwuid(3), or /bin/sh. This option should be configured when tmux is used as a login shell.

So, in your tmux.conf:

# set shell
set -g default-shell /bin/zsh

and if you want you can add default command each time, when we start a new window:

# Retach userspaces
set -g default-command "reattach-to-user-namespace -l zsh"

Tags:

Zsh

Tmux