Homebrew 安装的 gettext 和 git 不兼容?

Incompatible gettext and git installed by Homebrew?

$ git status
On branch master
...

dyld: Library not loaded: /usr/local/Cellar/gettext/0.19.4/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/gettext
  Reason: image not found
dyld: Library not loaded: /usr/local/Cellar/gettext/0.19.4/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/envsubst
  Reason: image not found
dyld: Library not loaded: /usr/local/Cellar/gettext/0.19.4/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/envsubst
  Reason: image not found
/usr/local/bin/gettext.sh: line 87: 10800 Abort trap: 6           envsubst ""
dyld: Library not loaded: /usr/local/Cellar/gettext/0.19.4/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/gettext
  Reason: image not found
dyld: Library not loaded: /usr/local/Cellar/gettext/0.19.4/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/envsubst
  Reason: image not found
dyld: Library not loaded: /usr/local/Cellar/gettext/0.19.4/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/envsubst
  Reason: image not found
/usr/local/bin/gettext.sh: line 87: 10841 Abort trap: 6           envsubst ""
nothing to commit, working tree clean

 $ ls /usr/local/Cellar/gettext
 0.19.8.1

看来我的 Git 由 Homebrew 安装想要访问 /usr/local/Cellar/gettext/0.19.4 哪个不存在?

我试过了

git reinstall git

徒劳。

假设我只需要安装0.19.4版本的gettext,我试图找到安装特定版本的Homebrew "formula"的方法,但网上找到的所有解决方案都证明可以已过时且无法正常工作。

Homebrew 的 gettext 默认不链接到 /usr/local/bin。某个时候可能链接了旧版本,并且该二进制文件指向过时的安装。为什么 git 与此相关联是另一个问题(假设您使用的是 Homebrew 的 git)。

首先尝试 brew unlink gettextbrew reinstall git --force-bottle。如果这不起作用,您可以用 brew link --overwrite gettext.

覆盖旧的链接版本