Change tmux default to zsh

user3549902 picture user3549902 · Apr 27, 2014 · Viewed 19.7k times · Source

When tmux opens, I would like it to use zsh instead of bash by default. How would I accomplish this?

Answer

jasonwryan picture jasonwryan · Apr 27, 2014

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"