Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run two different versions of tmux simultaneously?

Tags:

unix

tmux

Tmux 1.8 crashes the iOS Prompt app.

But I need 1.8 to get the iTerm2 integration.

So I'm hoping I can somehow make my server be able to run two tmux servers. However it looks like the Tmux 1.6 simply exits with status code 1 when I have the 1.8 server running.

I doubt that anybody's attempted something like this, but I'm curious...

like image 391
Steven Lu Avatar asked Apr 04 '13 04:04

Steven Lu


People also ask

How do I have multiple tmux sessions?

To create multiple windows, you need at least one tmux session running. You can simply type CTRL + b, let go of both keys and type 'c'. This will open up a new terminal. At the bottom, you can see that there are now multiple windows (0, 1, 2) in the session.

How do I switch between tmux sessions?

switching between sessions – the basic way It works by showing a list of sessions, and you can switch between these sessions by using Ctrl-N and Ctrl-P (check the title image).

How do I get all the tmux sessions?

To enter command mode, type prefix>: followed by list-sessions or ls to view a list of currently active Tmux sessions. By default, list-sessions are bound to the prefix> s key combination. With j and k, you may explore the session list and activate one by hitting enter.


1 Answers

You can run multiple instances of tmux (even different versions), but it may not work like you are expecting: they will be completely independent (different sessions, windows, panes, option values, etc.). The -L or -S option is used to specify a server socket name or pathname.

tmux new              # new session in the server at the "default" socket
tmux -L other attach  # new session in the server at the "other" socket

The default socket and the -L sockets live in $TMPDIR/tmux-$UID/, but you can use -S if you want to specify the full pathname yourself.

When you are “inside” a tmux session, the TMUX environment variables specifies the path to the server socket, so you generally do not need to specify the socket (path)name if you are just talking to the “surrounding” server: you can just use tmux neww to create a new window in the current session (no matter what socket pathname it is using).

However, there is another issue with trying to run two significantly different versions of tmux though. The tmux binary and the running server must speak the same “protocol version”. Due to some internal changes, the 1.6 and 1.8 versions use different protocol versions. This means that you can not use the 1.6 binary to talk to the a 1.8 server (i.e. a server started using the 1.8 binary), or vice versa. So, even though you might not need to specify the socket name (when running commands “inside” a session), you will probably need to specify the binary when trying to talk to your different servers.

tmux attach               # 1.8 talking to existing 1.8 "default" server
tmux-1.6 -L other attach  # 1.6 talking to existing 1.6 "other" server

You might be able to simplify things a bit by setting an environment variable and using a shell function (or a script, though take care not to create an infinite loop).

tmux() { command "${TMUXBIN:-tmux}" "$@"; }
like image 136
Chris Johnsen Avatar answered Sep 28 '22 01:09

Chris Johnsen