I recently switched from using screen to tmux (obtained through macports), as I like the feature set more. However, I can't seem to get tmux to reattach from an alternate location, like I can screen.
At home on my mac, I will open up iTerm2, my default shell is zsh, and I will begin a tmux session with tmux
. I get all my spits set up, ssh'd into the proper servers, etc., and work for a while. Time to go to work. <C-a> d
- tmux detaches.
I get to work, where I use a windows xp machine. I fire up putty, ssh into my mac back at home, attempt a tmux attach
, and get an error message:
no sessions
I cannot seem to determine why this would happen. I am not afraid to dig into this, but don't even know where to start. Thoughts?
P.S. I have already removed my .tmux.conf file, so it's using the default config.
tmux stores its server socket in a directory under the directory specified by the TMPDIR environment variable.
In your GUI session you probably end up with a TMPDIR that points to somewhere under
/var
(e.g./var/folders/mV/mVip4IQ4EXOriTiLJmeSuk+++Tc/-Tmp-/
).When you are logged in through SSH, you probably end up without a TMPDIR set, so tmux looks under
/tmp/
for its socket.On a 10.6 system, here is my TMPDIR with zsh/Terminal, and with zsh/SSH:
If you know the value you need to use for TMPDIR, you can specify it when attaching (or running some other tmux command outside of the session itself):
If you do not know the directory your GUI session was using you might be able to find it with something like this (the syntax is specific to zsh; it searches under
/var/folders/
for a directory named-Tmp-
that is owned by the current user):To avoid problems in the future, you might want to unset TMPDIR before starting your server (or set it to something that you can more easily predict).