I just installed tmux (a terminal multiplexer) with homebrew. When I try to run it, it always exits with [exited] Nothing shows up.

When I try to run tmux list-session I get an error:

failed to connect to server: Connection refused

I tried running tmux start-server, but again nothing happens.

What can I do?

  • 2
    start using the -v option to increase verbosity – Florenz Kley Mar 5 '12 at 17:03
  • 3
    Check your default-command and default-shell options. If tmux is having trouble running your default command (or shell) it will respond like you are describing. For further investigation, you can use do something like tmux new /bin/zsh to explicitly start with (e.g.) /bin/zsh instead of relying on default-command or default-shell. – Chris Johnsen Mar 6 '12 at 7:18
  • 3
    tmux new /bin/zsh worked for me. Thank you. – Stevens Mar 10 '12 at 15:13
  • Er, my suggestion was meant as a diagnostic step, not a final workaround. There is probably something buggy about your default-shell or default-command setting. – Chris Johnsen Mar 15 '12 at 11:58
  • I recently found (for the first time) that if 1) .tmux.conf exists but has syntax errors or 2) .tmux.conf is a symbolic link that links to nothing, tmux will not open. It might be good to try at first with the default configuration file so first mv $HOME/.tmux.conf $HOME/.tmux.conf.backup and see if tmux starts. @ChrisJohnsen is right, your solution simply means that there is a bug afoot. – scicalculator Apr 3 '12 at 5:16

I had this same problem. It was caused by having set-option -g default-command "reattach-to-user-namespace -l zsh" in my .tmux.conf without having reattach-to-user-namespace installed.

The fix was to install "reattach-to-user-namespace" via Homebrew (brew install reattach-to-user-namespace)

  • 2
    great thx! Exactly what was missing on my system to make it work! – DannyRe Sep 4 '12 at 23:24
  • 1
    +1 Thanks a ton! I had exactly the same issue. Do you know any way to set options conditionally so it won't fail on a system that doesn't have reattach-to-user-namespace installed? – Patrick Oscity May 8 '13 at 8:16
  • 2
    @padde See this solution. – jrhorn424 Oct 10 '13 at 22:16
  • Any idea how to achieve this in Ubuntu? Tried looking for a way to download reattach-to-user-namespace but my efforts were futile. – DaMainBoss Nov 23 '13 at 5:32
  • @DaMainBoss reattach-to-user-namespace is for tmux only. If you're on ubuntu just comment out that line from your .tmux.conf file – pho79 Feb 22 '15 at 3:41

Do make sure that the default-shell option only contains the executable path and does not contain options.

In /etc/tmux.conf or ~/.tmux.conf

set-option -g default-shell "/bin/bash"
set-option -g default-command "bash -l"
set-option -g default-path $HOME
set-option -g default-terminal "screen-256color"
  • This answer led me to the real reason, I had just uninstalled tcsh, and my default shell and default command were still set to it. Changing it to /bin/ksh, or a default installed shell of your choice, fixed it for me. – Jason Robinson Aug 20 '16 at 22:02

If you're using a script to wrap reattach-to-user-namespace, as outlined by jimeh, don't forget to make the script executable with chmod +x ~/bin/login-shell.

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.