I have been using Tmux a lot lately and was getting tired of having to attach to it everytime I start iTerm2. There had to be a way for me to initialize a Tmux session every time I start a new session of iTerm2. Luckily, it allows you to pass some text on startup! Using this feature (See below image for where…), I now pass up the below code to iTerm2:
tmux attach -t init || tmux new -s init
This snippet tries to attach to a Tmux instance called init
and if it cannot it attach it creates one for me.