How to install Git with PCRE support on macOS with Homebrew?

With homebrew, just use

brew reinstall --with-pcre2 git

It forces to build git from source instead of downloading the bottle, but ensures that the updates will be done with the pcre support.


Homebrew ships Git with a pre-built version (bottle) by default. You need to compile Git from source to enable PCRE support:

$ brew install pcre
$ export USE_LIBPCRE=yes
$ brew reinstall --build-from-source git

Now it should work as expected.