p:: Database f:: CLI, Homebrew, Postgres Docker

Install

postgresql - Correct way to install psql without full Postgres on macOS? - Stack Overflow

brew install libpq

This would give you psql, pg_dump and a whole bunch of other client utilities without installing Postgres.

...
 
==> Caveats
==> libpq
libpq is keg-only, which means it was not symlinked into /opt/homebrew,
because conflicts with postgres formula.
 
If you need to have libpq first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc
 
For compilers to find libpq you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/libpq/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/libpq/include"
echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

The Password File

PostgreSQL: Documentation: 15: 34.16. The Password File

The file .pgpass in a user’s home directory can contain passwords to be used if the connection requires a password (and no password has been specified otherwise).

This file should contain lines of the following format:

hostname:port:database:username:password
vim ~/.pgpass

Then, set the file’s mode to 0600. Otherwise, it will be ignored.

chmod 600 ~/.pgpass