I'm using the standard apple terminal with zsh as my default shell.

In my ~/.zprofile (equivalent of .profile) I have the following line:

[[ $TERM != "screen" ]] && exec tmux

This basically makes shure that if I open a new window in zsh a new tmux session is started, but tmux doesn't get started from within zsh sessions running inside tmux subwindows.

This works fine but for one thing: I cannot start XQuartz. Everytime I launch an from the command line that requires X11 (like a gnuplot or octave plot) the terminal just hangs and nothing happens.

However, I noticed that when I just disable the auto-launching of tmux by removing the line above so that I can open a new terminal window and launch XQuartz from there, I can also use the launched XQuartz from within tmux windows.

This however gets pretty tiresome.

How could I fix this?

1 Answer 1


Try moving [[ $TERM != "screen" ]] && exec tmux to your .zshrc file. That way the command will only be run in interactive shells.

An interactive shell is simply any shell process that you use to type commands, and get back output from those commands. That is, a shell with which you interact.

You must log in to answer this question.

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