To change the default shell in tmux, add set-option -g default-shell /path/to/shell
to your ~/.tmux.conf
file. You can also change it temporarily with Ctrl+b :set-option -g default-shell /path/to/shell
.
set-option -g default-shell /bin/zsh
tmux uses your system's default login shell by default. However, you might want to use a different shell specifically within tmux sessions. You can configure this either permanently in your configuration file or temporarily during a session.
To set a permanent default shell for tmux, add the following line to your ~/.tmux.conf
file:
set-option -g default-shell /bin/zsh
Replace /bin/zsh
with the path to your preferred shell. Common shells include:
You can also change the default shell for your current tmux session without modifying your configuration file:
set-option -g default-shell /bin/zsh
and press EnterThis change will only affect the current tmux server instance and will be lost when you restart tmux.
If you're unsure of the exact path to your preferred shell, you can find it using:
$ which zsh /bin/zsh
If you're using a non-standard shell like Fish, you might want to ensure tmux uses a login shell to properly source your profile files:
# Use Fish as default shell in login mode set -g default-command "/usr/local/bin/fish -l" set -g default-shell "/usr/local/bin/fish"
After changing your default shell, you may need to restart your tmux server for the changes to take effect. You can do this by stopping all sessions (tmux kill-server
) and then starting a new session.