Auto-Starting Tmux in iTerm2

Sašo Matejina
1 min readAug 31, 2016

--

Iterm2 & Tmux are awesome and they really work well together. I got annoyed today that every time I open a new tab I have to create a new session or re-attach existing one.

Iterm2 gives you an option to send some text to terminal after init. So I wrote a small sequence of commands that shows me existing sessions and gives me option to re-attach or create a new one.

Navigate to “Preferences > Profiles > PROFILE >Command > Send text at start” and set it to:

tmux ls && read tmux_session && tmux attach -t ${tmux_session:-default} || tmux new -s ${tmux_session:-default}

Small but nice improvement to my everyday workflow :)

--

--