问题
I am trying to run a unix command line for some i18n work on a project. Using gettext library my issue is about running msgmerge
$ msgmerge
zsh: command not found: msgmerge
I tried brew instal gettext
and brew link gettext
but with no success. This was working well on my previous machine, but can't make it work on a fresh install.
I can confirm binary is available in /usr/local/opt/gettext/bin/msgmerge
.
回答1:
Fixed. When running brew reinstall gettext
, command actually give the answer:
If you need to have gettext first in your PATH run:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.zshrc
Export is only triggered when opening a new zsh prompt, PATH was not updated yet and worked when I re-openned a new window.
回答2:
I tried running this brew link gettext --force
, but I was getting:
$ 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"
Then, I just added it to the system path with:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
Related:
- https://apple.stackexchange.com/questions/299048/can-not-use-the-gettext-which-is-installed-by-brew
- Homebrew refusing to link OpenSSL
- How to install gettext on MacOS X
- Installed, just not linked
来源:https://stackoverflow.com/questions/59644349/msgmerge-on-macos-catalina