1

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.

sebastienbarbier
  • 6,542
  • 3
  • 29
  • 55

2 Answers2

3

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.

sebastienbarbier
  • 6,542
  • 3
  • 29
  • 55
1

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:

  1. https://apple.stackexchange.com/questions/299048/can-not-use-the-gettext-which-is-installed-by-brew
  2. Homebrew refusing to link OpenSSL
  3. How to install gettext on MacOS X
  4. Installed, just not linked
Evandro Coan
  • 8,560
  • 11
  • 83
  • 144