Don't follow instructions from 2017. Follow the current instructions.
Go to the homebrew (brew.sh) site and copy/paste that installation string into the Terminal, and then press return. It requires at minimum, the command-line tools for Xcode 12.6 on Big Sur, and will attempt to install this package for you, before continuing to resolve the dependencies ( a great many) for GNUPlot 5.4.1. If you are on an M1 Mac, it expects /opt/homebrew as the destination for homebrew builds, and an Intel Mac expects /usr/local. You may have to create these directory locations if not present.
Once homebrew is successfully installed:
brew --version
brew update
brew upgrade
# shows the enormous dependency tree of other packages that must be installed for gnuplot
brew deps --tree --installed gnuplot
brew install gnuplot
brew cleanup
The current homebrew version at the time of this post is 3.1.9.
Once you have GNUPlot installed, you must change your ~/.bash_profile, or ~/.zshrc dot files to access the homebrew directory first in your PATH:
Intel:
export PATH=".:/usr/local/bin:${PATH}
Apple Silicon:
export PATH=".:/opt/homebrew/bin:/usr/local/bin:${PATH}
Then, depending if you are still using the Bash shell:
source ~/.bash_profile
or the Zsh shell:
source ~/.zshrc
and you can run Gnuplot right from the command-line, provided it was installed and compiled correctly. On an M1 Mac, your binaries will be compiled as arm64, and on an Intel machine, as X86_64.