Force linking gnu-getopt on macOS fails

I'm following the installation on macOS walkthrough but it fails on the second step when I run brew ln gnu-getopt --force

It dumps the following:

Warning: Refusing to link macOS-provided software: gnu-getopt
If you need to have gnu-getopt first in your PATH run:
  echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

Or when I switch from zch to bash, it will replace the last line with:
~/.bash_profile instead of ~/.zshrc

I tried to run echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc but it shows the same message again.