i added the tmux plugin to my .zshrc file and when i try to make it run on startup with TMUX_AUTOSTART=true it'll just shows the terminal window and disappears under a second. then i open it again and i can work. again after a while if i close the terminal and try to run it again it might happen or it might run correctly and let me work it's getting really annoying. and when i try other code to run tmux on start up like these:

if command -v tmux &> /dev/null && [ -n "$PS1" ] &&
          [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] &&
          [ -z "$TMUX" ]; then
    exec tmux


[[ $- != *i* ]] && return

[[ -z "$TMUX" ]] && exec tmux


[ -z "$TMUX"  ] && { tmux attach || exec tmux new-session && exit;}

or any other code, the terminal just opens up and close itself in under a second for ever. It closes every time then.

1 Answer 1


You have to put your ZSH_TMUX_AUTOSTART between your plugins and your oh-my-zsh source.

Like this:



source $ZSH/oh-my-zsh.sh

  • that's exactly where it is already Jul 18, 2020 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .