(Mac) -bash: __git_ps1: command not found (Mac) -bash: __git_ps1: command not found git git

(Mac) -bash: __git_ps1: command not found


You've installed the version of git-completion.bash from master - in git's development history this is after a commit that split out the __git_ps1 function from the completion functionality into a new file (git-prompt.sh). The commit that introduced this change, which explains the rationale, is af31a456.

I would still suggest that you just source the version of git-completion.bash (or git-prompt.sh) that is bundled with your installation of git.

However, if for some reason you still want to use this functionality by using scripts separately downloaded from master, you should download git-prompt.sh similarly:

curl -o ~/.git-prompt.sh \    https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh

... and add the following line to your ~/.bash_profile:

source ~/.git-prompt.sh

Then your PS1 variable that includes __git_ps1 '%s' should work fine.


After upgrading to OSX 10.9 Mavericks I had to reference the following files to get git shell command completion and git prompt to work again.

From my .bash_profile or similar:

if [ -f /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash ]; then    . /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bashfisource /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh#shell prompt examplePS1='\u $(__git_ps1 "(%s)")\$ '


You should

$ brew install bash bash-completion git

Then source "$(brew --prefix)/etc/bash_completion" in your .bashrc.