When I run $ /usr/bin/env bash (but not otherwise) I get the error: __git_ps1: command not found

I've tried updating ~/.git-prompt.sh and ~/git-completion.bash for the version of git that I'm using. I've confirmed that the lines source ~/git-completion.bash and source ~/git-prompt.sh are present in ~/.bash_profile.

The error doesn't appear when I only open Terminal from Finder, but when I run $ /usr/bin/env bash the error appears every line.

MacOS 10.10.5, bash 5.0.17(1)-release, git 2.22.0

  • Why are you env bash? I presume you are not adding the $ but this might need an edit to show your entire prompt and command and results instead of inline code blocks... – bmike Oct 26 '20 at 2:19
  • Hi @bmike , I'm troubleshooting some software & have been asked to run env bash by the developer. I use $ for clarity of showing that this section is a command entered to bash, the $ isn't entered as part of the command. – Scottmeup Oct 26 '20 at 3:19

The developer probably wants your output of env to suss out why your variables are not as expected. Running env with arguments tries to locate it in the path explicitly and without arguments dumps all the variables.

  • 1
    Thanks bmike, can I confirm if my understanding is correct: env bash is loading my user's .bash_profile but __git_ps1 got dumped because it wasn't loaded when I ran env without an argument specifying how to load it? I guess I shouldn't worry about this error then? – Scottmeup Oct 26 '20 at 3:40
  • Yes @Scottmeup you do have some cruft that’s not resolving the second time you run the dot files so maybe trim down the dot files if you have issues, most people don’t run the shell twice and have clean runs when you recursively embed shells. – bmike Oct 26 '20 at 17:28

You must log in to answer this question.

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