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.

2 Answers 2

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

4
  • now i get Warning: Some keg-only formula are linked into the Cellar. Linking a keg-only formula, such as gettext, into the cellar with brew link <formula> will cause other formulae to detect them during the ./configure step. This may cause problems when compiling those other formulae. Binaries provided by keg-only formulae may override system binaries with other strange results. You may wish to brew unlink these brews: gettext
    – broinjc
    Apr 29, 2014 at 23:56
  • hey @broinjc there's no harm in the warning you are receiving, it's highly unlikely that you'll need to compile other packages based on the ones you have already installed. one problem at a time, ok? ;)
    – gru
    May 9, 2014 at 8:15
  • yes one problem at a time ;) haha.
    – broinjc
    May 12, 2014 at 20:10
  • I think saying "just run ... --force" is dangerous, and should also hint as to when this ok. People coming here might actually end up having to compile packages where this can produce issues.
    – ankon
    Aug 27, 2018 at 10:53
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

You must log in to answer this question.

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