twolfson / sexy-bash-prompt

Bash prompt with colors, git statuses, and git branches.
MIT License
1.14k stars 155 forks source link

MacOSX doesn't work ootb since OSX doesn't use .bashrc #9

Closed SCdF closed 11 years ago

SCdF commented 11 years ago

MacOSX doesn't use ~/.bashrc. Instead it uses the first file it finds out of a specific list, shown here: http://apple.stackexchange.com/questions/12993/why-doesnt-bashrc-run-automatically#comment13715_13019

To make your script work locally on MacOSX I took the hook you added in bashrc and added it to .bash_profile instead. It sounds though, like you might need to make sure you put it in the right one (since the creation of .bash_profile would stomp on .profile)

SCdF commented 11 years ago

(Note that is appears to work the first time since you call source on bashrc, but it won't get run on the creation of a new term)

twolfson commented 11 years ago

Yikes! That's what I get for testing on a non-fresh machine. Alright, I will look into this. Thanks!

twolfson commented 11 years ago

I have read up on this and it seems that the . ~/.bashrc should be handled on an OS by OS basis. However, on Ubuntu, the prompt isn't picked up in .bash_profile, .bash_login, or .profile.

I have chosen to avoid the complexity of detecting if .bash_profile has .bashrc being invoked inside of it. It opens possibilities for more edge cases and expands outside of the one-thing-well paradigm.

Instead, I have added a FAQ section with a question about "The prompt is not present in new shells" in 0.10.7.

twolfson commented 11 years ago

I came up with a better solution when I woke up today:

One annoying part will be testing this. I would also consider releasing that in a separate project, just not sure how re-usable it will be.

twolfson commented 11 years ago

Wrote out gist of this today. Unfortunately, I am bumping heads with Travis CI on getting the test working with bash -i and going to sleep out of frustration/tiredness

https://github.com/twolfson/sexy-bash-prompt/compare/dev;graceful.install?expand=1

twolfson commented 11 years ago

Tested on OSX and looks good. Unfortunately, the trigger inside of install.sh does not expand to the parent shell (TODO).

twolfson commented 11 years ago

Gave up on Travis CI testing of installation. Released install script which handles .bashrc not being invoked in 0.11.0.