These instructions allow you to intall psql, pg_dump & pg_restore without a full installation of postgresql.
First, install libpq via homebrew
brew doctor
brew update
brew install libpq
Since libpq is keg-only, you will need to manually add the bin directory to your $PATH
variable
If you use zsh:
echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# or on M1 MacOS
echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
If you use bash:
echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
See als: SO