20

I am doing some web development and the translation engine requires gettext. Should I force link it?

$ django-admin.py makemessages -l es
CommandError: Can't find xgettext. Make sure you have GNU gettext tools 0.15 or newer installed.

$ brew install gettext
Warning: gettext-0.18.3.2 already installed

$ brew link gettext
Warning: gettext is keg-only and must be linked with --force
Note that doing so can interfere with building software.
broinjc
  • 305

2 Answers2

32

same problem here, just run

brew link gettext --force

and

manage.py compilemessages

and everything working fine. you can always

brew unlink gettext

if you have problems and revert back to previous state

gru
  • 436
  • 5
  • 4
0

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. 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
user
  • 537