Home > Software design >  How to compile git with PCRE on Mac?
How to compile git with PCRE on Mac?

Time:02-25

I need the PCRE for this command - git log -i -P --all --grep='^(?=.*fix)(?=.*a)(?=.*bug)'

It shows - fatal: cannot use Perl-compatible regexes when not compiled with USE_LIBPCRE

I tried -

brew reinstall pcre git
brew reinstall pcre2 git

And the output of the brew config is

HOMEBREW_VERSION: 3.3.16
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2dc375acc2fe4e089d103171ec8fb06a87d83bb6
Last commit: 2 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 528cff0f77f4ab9f8bccfae8d148eced81eeb3d5
Core tap last commit: 39 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_CORE_GIT_REMOTE: https://github.com/Homebrew/homebrew-core
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: quad-core 64-bit kabylake
Clang: 13.0.0 build 1300
Git: 2.19.0 => /usr/local/bin/git
Curl: 7.77.0 => /usr/bin/curl
macOS: 12.2.1-x86_64
CLT: 13.0.0.0.1.1627064638
Xcode: N/A

Also followed the steps from this question - How to install Git with PCRE support on macOS with Homebrew?

CodePudding user response:

According to brew history, git was at version 2.19 back in the year 2018. PCRE2 was optional at the time. Presently, in 2022 we are at 2.35.1 and PCRE2 comes standard.

To bring your items up-to-date:

brew update
brew upgrade

CodePudding user response:

I found a solution, I am posting it here in case anyone needs it

  brew link --force git # showed I have another git 
  rm '/usr/local/bin/git' # had to remove it
  brew uninstall git && brew install git
  brew link --overwrite git # then linked
  brew link --overwrite --dry-run git # optional
  git --version
  • Related