当我运行如何在OSX上用homebrew安装带PCRE支持的Git?
$ git grep -P "<pattern>"
我得到以下错误:
fatal: cannot use Perl-compatible regexes when not compiled with USE_LIBPCRE
我怎么能与OSX正确PCRE支持安装的Git?
当我运行如何在OSX上用homebrew安装带PCRE支持的Git?
$ git grep -P "<pattern>"
我得到以下错误:
fatal: cannot use Perl-compatible regexes when not compiled with USE_LIBPCRE
我怎么能与OSX正确PCRE支持安装的Git?
随着自制,只是用
brew reinstall --with-pcre2 git
它迫使从源代码编译的git,而不是下载的瓶子,但保证了更新,将与PCRE支持来完成。
Homebrew默认使用预置版本(瓶)Git。您需要从源代码编译Git以启用PCRE支持:
$ brew install pcre
$ export USE_LIBPCRE=yes
$ brew reinstall --build-from-source git
现在它应该按预期工作。
仅供参考,这不适用于我的OS X 10.10.2 system-git仍然抱怨它没有与pcre编译。但是,GaëtanLehmann更直接的回答('brew reinstall --with-pcre git')。 – jacobsa
请注意,每次'brew升级'时都必须运行此操作。跟着盖埃坦的回答。 –
在MacOS 10.12,Git 2.12上为我工作。虽然两者都是有效的,但我更喜欢这个更简洁的解决Loïs的答案,因为它可以在Git的brew升级中幸存下来。 –
现在在2018年3月:'警告:git:--with-pcre已被弃用;使用--with-pcre2来代替!' 所以你必须'brew重新安装--with-pcre2 git' – akhaku
已更新。谢谢! –