Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently uninstalled Homebrew and Cellar (web dev applications), and this error now appears after every Terminal command (although I can't confirm that these are the culprits!):

-bash: __git_ps1: command not found.

I reinstalled both applications yet the error message still happens! I'm attaching my Bash file just incase it's related - PasteBin

share|improve this question
up vote 2 down vote accepted

You probably want to look in your ~/.bash_prompt file, or whatever file is setting PS1 (the shell prompt format) for you. Your PS1 variable is referencing the Git prompt function, which I assume got uninstalled or something. You'll want to remove the $(__git_ps1 " (%s)") part from your PS1 value.

share|improve this answer
I've checked my ~/.bash_prompt file (see attached in original) and I can't find anything referencing that. Is there a quicker way of, say for instance, searching for this PS1 value? – Ben Sep 18 '13 at 16:57
I didn't see your ~/.bash_prompt file in your paste. But you can run a command like find ~ -type f | xargs fgrep PS1= to find where PS1 is getting set. If it's not in ~, then try replacing that with /etc. – jjlin Sep 18 '13 at 17:15

Assuming that you want (or eventually might want) to use git, then the git status in the prompt is quite useful. If using the git-osx-installer, source git-completion.bash (e.g. found in /usr/local/git/contrib/completion/) from your .bash_profile (or .bashrc or .bash_prompt etc), in order to to define the function __git_ps1.

Alternatively, you may prefer to install git & the corresponding git bash completion via macports (sudo port install git-core +bash_completion) or via homebrew, following the respective install steps for each. (See also: How to get git-completion.bash to work on Mac OS X?)

The main gotcha for bash completion is that it requires a newer version of bash (>= 4.1) than comes w/ OSX by default, so you will want to install/use the newer bash that comes with macports/homebrew/etc. (echo $BASH_VERSION).

Alternatively, if you don't want to deal with hacking your PS1 prompt or installing git & git completion, you may simply define the function yourself to be a no-op (e.g., in your .bashrc or .bash_profile etc):

__git_ps1() { : ; }
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .