On a new setup, tmux is using bash instead of my default (zsh).

How can I force it to use zsh?

  • 12
    figured it out. Can set the following in tmux config: set -g default-command /bin/zsh set -g default-shell /bin/zsh
    – re5et
    Mar 6 '11 at 5:33
  • 5
    FWIW, you don't need to set default-command if you've set default-shell. Feb 29 '12 at 20:03

10 Answers 10

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

in ~/.tmux.conf or /etc/tmux.conf. Works on Fedora.

You can reload the config with <leader>: source-file <conf file> e.g.

<C-b>: source-file ~/.tmux.conf

You would need to do it for every tmux instance. Otherwise you may restart tmux with killall tmux; tmux

  • 9
    If this doesn't work for you then make sure you've restart tmux. Seems obvious but took me a good hour to figure out!
    – Andy Smith
    Sep 20 '12 at 20:55
  • 33
    BTW: Restarting tmux means killall tmux; tmux. Took me quite a while to figure out.
    – js-coder
    Dec 21 '12 at 14:48
  • 7
    Configs could be reloaded without killing a server: bind R source-file ~/.tmux.conf \; display-message " Config reloaded..". Jul 2 '13 at 8:01
  • 18
    Or simply run tmux source-file ~/.tmux.conf from the command line.
    – Petr
    Oct 29 '14 at 12:43
  • 18
    @js-coder: to more cleanly kill your tmux server I'd recommend tmux kill-server instead.
    – Chuim
    Feb 13 '15 at 22:32

First, ensure your default shell is set properly to zsh by running this in your command line:

chsh -s $(`which zsh`) $USER

Placing the following in your ~/.tmux.conf is a more robust option for any shell.

set-option -g default-shell $SHELL
  • 1
    It is unnecessary to set user shell (chsh -s) as tmux offers an option independent of that. May 30 '17 at 6:00
  • 1
    I thought it was more robust to use the $SHELL variable. But it adds an extra step and confusion so I do prefer the accepted answer.
    – DebugXYZ
    Jan 13 '19 at 22:05
  • This is better than the accepted answer. My zsh is not installed in /bin/zsh.
    – HappyFace
    Aug 4 '19 at 17:56
  • Is the double command substitution intended?
    – dessert
    Jan 20 '21 at 15:24

For MacOS users, drop this line in the bottom of your ~/.tmux.conf

set-option -g default-command "reattach-to-user-namespace -l zsh"

After you add that, kill and restart your tmux server and all should work.

  • 2
    Er, is there any indication that re5et (the OP) is on a Mac, or has that wrapper program installed? Feb 1 '12 at 7:13
  • 1
    I think this answer only works for Mac OS X
    – EhevuTov
    Jul 25 '13 at 6:29
  • 6
    tmux kill-server is the command to end all tmux servers Oct 14 '13 at 17:05
  • 2
    Although it wasn't the answer the OP asked for, I ended up in this thread and indeed I am on OS X, using this wrapper, and this is the solution I needed; so Thank You!
    – Jose Alban
    Sep 24 '15 at 11:47
  • 2
    how does this differ from set-option -g default-shell ? the above does not seem to work with the Fish shell.
    – Tommy
    Feb 9 '16 at 1:50

tmux appears to use the SHELL environment variable, so the following should work:

SHELL=/usr/bin/zsh tmux


env SHELL=/usr/bin/zsh tmux
  • Not sure why this was down-voted. It appears to be correct: a common problem is using a different shell for e.g. iTerm but leaving login shell as /bin/bash to ensure nothing non-iteractive breaks. iTerm will not set $SHELL to the new shell name (unsure why), and bash initialisation will set it to the login shell if unset at startup. tmux then uses this value if default-shell is not set explicitly. Nov 4 '16 at 8:38
  • Yeah.. maybe env SHELL=/usr/bin/zsh tmux is better? (updated the answer).
    – blueyed
    Nov 6 '16 at 0:33

If you want to force tmux to use the same shell as specified in your environment variable, you could use:

# force SHELL ENV variable as shell
set-option -g default-shell ${SHELL}

in your ~/.tmux.conf or /etc/tmux.conf.

To get the change to actually take effect, you may need to tmux kill-server and then tmux to restart tmux.

  • 1
    This is the only answer that worked for me (the tmux kill-server command)
    – undefined
    Jan 27 '18 at 0:30

Use chsh(1):

chsh -s /bin/zsh $USER
  • 1
    i already had this set, but tmux was ignoring it.
    – re5et
    Mar 6 '11 at 5:33

The accepted answer did not work for me.

I had to write both

set -g default-shell  "/bin/bash"


set -g default-command "/bin/bash"

in my ~/.tmux.conf — Dont forget to run the following commands to reload the tmux.conf:

tmux kill-server; tmux

Im am using tmux -V 2.6 under Ubuntu 18 in the gnome-shell emulator.

I also enhanced tmux with https://github.com/samoshkin/tmux-config. Check it out, it's really cool.


Add this into your ~/.tmux.conf

set -g default-command /usr/local/bin/fish

Log-out and log-in again fixed my problem. When echoed $SHELL it was still /bin/bash but after log-out it was changed to /usr/bin/zsh


For me I had to replace:

default-command "/usr/local/bin/fish"
default-shell "/usr/local/bin/fish"


set-option -g default-command "/usr/local/bin/fish"
set-option -g default-shell "/usr/local/bin/fish"

in .tmux.conf and run command tmux kill-server; tmux

  • This is a duplicate of answer superuser.com/a/1370909/174140.
    – 174140
    Sep 18 '19 at 9:31
  • @john I've used set-option -g instead of set -g. different versions of tmux most probably
    – Ali Amin
    Sep 19 '19 at 11:24
  • set is an alias for set-option.
    – 174140
    Sep 19 '19 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.