Can not use the `gettext` which is installed by brew

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