bashgitgit-commitpre-commitpre-commit.com

"Pre-commit" command is not found by bash but is installed on macOS


Problem Description

I'm having trouble making commits, when I try to make a commit with the command, for example:

$ git commit -m "add readme"
pre-commit not found. Install pre-commit with the command pip3 install --user pre-commit or follow the steps on official documentation: https://pre-commit.com /#install

Following the steps described in the pre-commit installation documentation I installed by the command:

$ pip install pre-commit

However when I trigger the command the following error occurs:

$ pre-commit --version
bash: pre-commit: command not found

My attempt fails, so I've tried some other solutions for this but they didn't work.

Export bash:

I already tried this solution described that would be to export my ~./bashrc with the command: source ~/.profile but the following error happens:

bash:/Users/pvieira/.profile: No such file or directory

Install using homebrew:

This results in the same error that occurs when manually installing by pip above.


Solution

  • I was able to solve the problem by simply restarting the terminal.