Issue
I did some updating on my Mac and seem to have broken some of my settings. I have the following set in my .bash_profile
export PS1="\W $"
This is working in my normal bash session to show just the current directory instead of the whole path. However, when I switch into tmux, it again displays the whole path. Other changes to the PS1 in the bash profile such as color or other characters work fine and are reflected in tmux. I have emptied out my .tmux.conf to see if that was causing conflict but there was no change to this behavior.
I did create a new user on the system and tried the same PS1 and it worked perfectly in both a normal session and tmux.
I am mostly confused because I know I had it working and can't figure out what would have changed in the update. What files besides .bash_profile and .tmux.conf could be at play here? Is there a way to tell where tmux is pulling it's settings from?
Additional info: This behavior is the same in both iTerm2 and Terminal Tmux version 1.8 Mac OSX 10.9.1
Solution
Add the following to your .tmux.conf
:
new -n WindowName bash --login
You can replace WindowName
with whatever you want the first window to be named. When bash
is invoked this way, it sources to your .bash_profile
, .bash_rc
, .profile
, etc. which is where you change your $PS1
.
Answered By - Coder-256 Answer Checked By - Clifford M. (WPSolving Volunteer)