Filippo Valsorda has a solution for OS X that incorporates iTerm 2, tmux, and mosh.
His solution uses a single window/tab to connect to a remote shell. The shell survives disconnects (e.g., connection failure, IP changes, laptop reboots) and supports scrollback with a touchpad, copy-paste, and colors.
Caveats are that you must build mosh from source, scrolling is less fluid than native, and click-drag is relayed, so you must hold Option to select.
In the Terminal Profile settings, Enable xterm mouse reporting and set Report Terminal Type to xterm-256color.
~/.tmux.conf on the server to the following. With these settings, if you try to attach and there are no sessions, a new one is created. The settings also enable mouse interactions (and thus touchpad scrolling).
set-window-option -g mode-mouse on
set -g history-limit 30000
Note: On more recent tmux (i.e. > 2.1), as reported by
tmux -V, the various mouse options (mouse-resize-pane, mouse-mode, etc.) have been rewritten to a single option
mouse, so you have to change the second line above to
This mouse scroll will also work when you are in keyboard scroll mode (e.g. Ctrl-b then [), described in the article How to scroll in tmux.
The stable build of mosh is old and does not support mouse reporting (and touchpad scrolling). To install the latest version, do the following:
OS X (your client)
brew install --HEAD mobile-shell
Linux/UNIX (the server)
git clone https://github.com/keithw/mosh.git
sudo apt-get build-dep mosh
./autogen.sh && ./configure && make
sudo make install
Now, to connect, just type the following:
mosh HOST -- tmux a