I'm currently using urxvt with tmux, run as such:

urxvt -e tmux

I wish to start up a completely separate instance of urxvt -e tmux (another urxvt, also running tmux) using the terminal. (More precisely, I would like a command that does so, so that I can use it in my terminal-based programs.) I can't find the right command for this, however. No matter what I try, the following error occurs:

sessions should be nested with care, unset $TMUX to force

Is there a command, or failing that an indirect method, of starting up a new urxvt -e tmux without nesting? (The second "urxvt" would have nothing to do with the first one; I just wish to trigger the spawning of a second one, also running tmux.)

Thank you.


All you need to do to do this is (as the error message says) unset the $TMUX variable:

(unset TMUX; urxvt -e tmux)

The subshell is necessary to avoid it being unset in your current environment, too. If you don't care about that, you don't need the subshell.

  • How can I tell that it's safe/unsafe to do so? (Sorry if it's a silly question, but when I looked online I kept seeing people adamant that you shouldn't be unsetting it, and should be avoiding the error instead.) Also, does it work as well for (unset TMUX; urxvt -e tmux) & – spacingissue May 7 '15 at 15:33
  • @spacingissue It's safe -- nesting tmux sessions does require some care (you need to think about how to send the prefix easily to the nested sessions, for example), but there's nothing harmful about unsetting TMUX -- it's the normal way to do this. In your case, you're not even nesting. As for your question about backgrounding, yes, that will also work. – Chris Down May 7 '15 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.