MacOS – “__git_ps1: command not found” from running “/usr/bin/env bash”

bashcommand linegitmacos

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

Best Answer

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.