Macos – How to configure tmux/iTerm to display session name as title in terminal tab

itermmacostmux

I am getting started using tmux and iTerm2 on Mac OS X. Currently, all my tabs are titled "tmux" (assuming it's just displaying the process name) which makes it difficult to find the tab that I want. How do I configure tmux (or iTerm) to display the name of my tmux session in the tab?

Best Answer

I added this capability by...

  1. Adding the following line to my .tmux.conf to include the following line

set-option -g set-titles on

  1. Starting my tmux session with the -s switch

tmux new-session -s session_name

I have not yet figured out how to set the title from within the session, but it should be possible. Hope that helps!

Source URLs:

Rename Iterm2 tab from within tmux

https://gist.github.com/henrik/1967800

Related Question