如何在 Mac 上使用 PCRE 编译 git?

发布于 2025-01-09 04:10:18 字数 1217 浏览 1 评论 0原文

我需要此命令的 PCRE - git log -i -P --all --grep='^(?=.*fix)(?=.*a)(?=.*bug)'

它显示 - fatal: Cannot use Perl-兼容的正则表达式,当未使用 USE_LIBPCRE 编译时

我尝试过 -

brew reinstall pcre git
brew reinstall pcre2 git

并且brew配置的输出

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

也遵循了这个问题的步骤 - 如何使用 Homebrew 在 macOS 上安装带有 PCRE 支持的 Git?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

执手闯天涯 2025-01-16 04:10:18

根据brew历史记录,git早在2018年就有2.19版本。当时PCRE2是可选的。目前,到 2022 年,我们将达到 2.35.1,并且 PCRE2 将成为标准。

要使您的项目保持最新状态:

brew update
brew upgrade

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
丑疤怪 2025-01-16 04:10:18

我找到了解决方案,我将其发布在这里以防有人需要它

  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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文