After I install the gettext in my mac:

I use the brew install gettext command installed it.

CPPFLAGS: -I/usr/local/opt/gettext/include

==> Summary
🍺  /usr/local/Cellar/gettext/ 1,934 files, 16.9MB

I can not use the gettext still.

$ gettext --help
-bash: gettext: command not found

That formula doesn't link - you can do it by hand if you require it:

This formula is keg-only, which means it was not symlinked into /usr/local, because macOS provides the BSD gettext library & some software gets confused if both are in the library path.

The maintainers recommend:

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

You can even get a more explicit warning by trying to link it manually:

$brew link gettext.

Warning: gettext is keg-only and must be linked with --force.

Note that doing so can interfere with building software.

If you're sure you need it linked everywhere:

brew link gettext --force

See this SU thread for details https://superuser.com/questions/747324/brew-install-gettext-should-i-force-link-it

  • Also you can add it to oh-my-zsh -> echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.zshrc – Gandarez Aug 30 '19 at 21:44

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


  1. Can not use the `gettext` which is installed by brew
  2. https://stackoverflow.com/questions/38670295/homebrew-refusing-to-link-openssl
  3. https://stackoverflow.com/questions/14940383/how-to-install-gettext-on-macos-x
  4. https://stackoverflow.com/questions/29422345/installed-just-not-linked
  5. https://stackoverflow.com/questions/59644349/msgmerge-on-macos-catalina

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .