macos Catalina 上的 msgmerge

msgmerge on macos Catalina

我正在尝试 运行 一个 unix 命令行,用于项目中的一些 i18n 工作。使用 gettext 库 我的问题是关于 运行ning msgmerge

$ msgmerge
zsh: command not found: msgmerge

我尝试了 brew instal gettextbrew link gettext 但没有成功。这在我以前的机器上运行良好,但无法在全新安装上运行。

我可以确认二进制文件在 /usr/local/opt/gettext/bin/msgmerge 中可用。

已修复。当运行brew reinstall gettext时,命令实际给出答案:

If you need to have gettext first in your PATH run:
  echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.zshrc

导出仅在打开新的 zsh 提示符时触发,PATH 尚未更新并且在我重新打开新的 window 时起作用。

我试过 运行 这个 brew link gettext --force,但我得到:

$ brew install gettext
Warning: gettext 0.20.2 is already installed and up-to-date
To reinstall 0.20.2, run `brew reinstall gettext`

$ brew link gettext --force
Warning: Refusing to link macOS provided/shadowed software: gettext
If you need to have gettext first in your PATH run:
  echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile

For compilers to find gettext you may need to set:
  export LDFLAGS="-L/usr/local/opt/gettext/lib"
  export CPPFLAGS="-I/usr/local/opt/gettext/include"

然后,我将它添加到系统路径中:

echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile

相关:

  1. https://apple.stackexchange.com/questions/299048/can-not-use-the-gettext-which-is-installed-by-brew
  2. How to install gettext on MacOS X