Tmux integration not sourcing .bashrc on re-attach.
Thanks for filing an issue! Please answer the questions below so I can help you.
- iTerm2 version: 3.2.5
- OS version:Mac OS Mojave
- Attach ~/Library/Preferences/com.googlecode.iterm2.plist here (drag-drop from finder into this window)
- Attach a debug log, if possible. Instructions at https://iterm2.com/debuglog
Detailed steps to reproduce the problem:
I am using iTerm2 integrated with tmux. My normal working pattern is to first open up the iTerm2 terminal on my Mac, and then ssh to my dev Virtual Machine.
My dev VM has tmux installed, so that I can re-attach the tmux sessions to my dev VM.
The problem is when the first time I create the tmux session it will source ~/.bashrc with no problem. But if I clean detach tmux session, and later re-attach those tmux sessions, the ~/.bashrc will not be sourced.
I have included
if [ -f ~/.bashrc ]; then source ~/.bashrc; fi in ~/.bash_profile, .profile, .bash_login.
And also included
set-option -g default-command "exec /bin/bash" to ~/.tmux.conf
I did some experiment. More specifically, my problem only happens when using the iTerm2's Tmux integration. That means: 1) if I use standard Tmux syntax, say I create a tmux session with tmux, then detach with tmux detach, and later re-attach with tmux attach -t 0. Everything works fine 2) if I re-attach with iTerm2's tmux integration with tmux -CC attach, my base16 shell defined in ~/.bashrc is not sourced, and my vim color scheme is messed up. I need to source .bashrc manually
And also, although the base16 shell is not sources correctly, the rest of .bashrc setting are sourced correctly...