Why does zsh kills my process every time I enter a git command

Here I put the final solution. I tried many methods on my mac M1, the best method is re-install homebrew.

Step1:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

Step2: Install homebrew

cd /opt 
mkdir homebrew # if not exist, just create one.
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

Then, the problem solved.


I used the below commands:

brew uninstall git
brew update
brew reinstall pcre2 gettext
brew install git

Git worked after.


To find out the cause of the crash, you can open Console with + spacebar, then go to "Crash Reports".

If you scroll down a bit, you will find the source of the error:

Application Specific Information:
dyld: launch, loading dependent libraries
/opt/homebrew/opt/gettext/lib/libintl.8.dylib

So in this example, a simple brew reinstall gettext will fix the issue (unless there is also an issue in another dependency of course).

To fix all dependencies issues in a single step, you could also simply do brew reinstall $(brew deps git).