I searched the net and many people complained that tmux wasn't executing their .bashrc. The solution thats suggested everywhere was to source .bashrc from within .bash_profile cos tmux launches bash as a login shell and we can be sure that .bash_profile is executed for login shells.

Unfortunately, even this solution isn't working for me. I tried duplicating commands/aliases in both .bash_profile and .bashrc. Even that doesn't seem to work. I don't have a .tmux.conf file at all if that would mess up anything.

Contents of .bash_profile looks like

[pmanjunath 12:29:13 ~]$ cat .bash_profile
source ~/.bashrc

Contents of .bashrc looks like

[pmanjunath 12:29:36 ~]$ cat .bashrc
PS1="\[\e[35m\][\u \t \w]$ \[\e[0m\]"
export CSCOPE_EDITOR=vim
CSCOPE_DB=~/cscope/cscope.out; export CSCOPE_DB
alias cs='`which cscope` -d'
alias fs='cd /data/fs'
alias real='cd /data/debug/src/prog/realstore'
alias mnt='cd /mnt/tintri'
alias psg='ps -eaf | grep realstore'
set -o vi

And launching tmux screws my PS1 like below unless I rerun ~/.bash_profile-


EDIT A strange thing happened. I tried to debug tmux by hooking it up with strace. What I saw was, tmux was unable to find some libevent2 library. So installed it like

rpm -ivh /auto/toolchain/rpms/fedora12/libevent2-2.0.21-6.tt.x86_64.rpm

After this, tmux started executing my bash profile BUT only when run with strace!! If I just say, tmux, the same old problem exists! I really dont know what magic is strace pulling off.

  • Can you show us the bit in .bash_profile where you've sourced .bashrc – EightBitTony Feb 23 '16 at 20:23
  • @EightBitTony I added all additional details to the Qn. Thanks – Pavan Manjunath Feb 23 '16 at 20:31
  • Interesting. I've tested with a new user using your .bashrc and .bash_profile and it works perfectly fine. What happens if you add a new user with these files? – gollum Feb 23 '16 at 20:54
  • @gollum. Created a new user and copied over the contents of .bashrc and .bash_profile. Still the same issue – Pavan Manjunath Feb 24 '16 at 2:07
  • show strace -e open,access -f tmux – KWubbufetowicz Feb 29 '16 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.