This question already has an answer here:
- Changing tmux .bash_profile behavior 2 answers
The original question
Is it possible to override
tmux's default behaviour of executing
.[z|bash_]profile files on every new session, window and pane?
In other words, I'd like it to only execute only the relevant
.[zsh|bash]rc script, i.e. for the new session/window/pane to behave like an
urxvt, not like a
More specifically (edit)
I'd like to avoid changing anything to my
.*rc scripts. I'm looking for a way to ask
tmux to open non-login shells in its new sessions, windows and panes by properly configuring it in
.tmux.conf, in order to keep the prior philosophy of putting only actual 'login' instructions on
.*profile scripts, as recommended for instance here: What should/shouldn't go in .zshenv, .zshrc, .zlogin, .zprofile, .zlogout?
I am aware on how to circumvent the issue by hacking e.g.
.zprofile as was answered to Changing tmux .bash_profile behavior , but the question is of how to do it from
tmux load the
.*profile scripts by default, on every session, window and pane, whereas subshells on any context and all (or at least most) variants of X terminals don't?
Some background information (not necessarily relevant)
I barely started using
tmux (only occasionally, for now), but I do have an ever-evolving setup, using
zsh as my shell of choice, in which
.zprofile expects to be called from a
tty and do relevant stuff (like deciding to run
startx or not based on whether it's on a laptop and the tty number), the
.zshrc script expects to be called from any interactive environment and the
.zshenv script expects to be loaded whether on an interactive environment or not.
EDIT: Solution (based on comments below)
Adding the following line to
tmux's behaviour and defaults to starting non-login interactive shells (zsh in this case) on new
sessions, windows and panes:
set-option -g default-command zsh