In my .zshrc, I have ENABLE_TMUX="TRUE" for one of the lines. This doesn't seem to work, as tmux never launches on a new shell, and the environment variable ENABLE_TMUX is always false when I start a shell. The rest of my zshrc works fine, however. I'm not sure why this wouldn't work.

if [ "$ENABLE_TMUX" = "TRUE" ]; then
    # start tmux if not already running
    if [[ ! "$TTY" =~ "/dev/tty" ]]; then
        case $(ps -p $(ps -p $$ -o ppid=) o args=) in
                sleep 0

This is the function that starts tmux. Not sure what's wrong here, if anything. I am on Xubuntu 18.04.

  • I've just tried it and it works for me, make sure that this function is run at all by adding several printfs or echos here and there and if it is that means you do not enter if condition at all or enter the first case or tmux fails to start. Try to run tmux in interactive shell first to make sure. Apr 29, 2019 at 19:33
  • Sorry, I missed that you said that ENABLE_TMUX is always FALSE - it means that it has be explicitly set to FALSE somewhere before reaching this function as variables do not take FALSE as value implicitly. Try to do ENABLE_TMUX=TRUE in the line above if [ "$ENABLE_TMUX" = "TRUE" ]; then and it should work. You could also show your entire ~/.zshrc if you are not sure what's going on. Apr 29, 2019 at 19:39
  • Not sure what's causing it to reset itself before the function, but setting it to true immediately before the function works. I'll dig through my zshrc and try to find what was causing the problem, but this is fine too. Thanks! Apr 29, 2019 at 19:43

1 Answer 1


ENABLE_TMUX is not reset at all.

In .zshrc, [[ ! "$TTY" =~ "/dev/tty" ]] is not true. So no tmux session will be started.

You must log in to answer this question.

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