# tmux exits with [exited] on mac os x

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?

-
start using the -v option to increase verbosity –  Florenz Kley Mar 5 '12 at 17:03
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
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)

-
great thx! Exactly what was missing on my system to make it work! –  DannyRe Sep 4 '12 at 23:24
+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
@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

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"
-

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.

-