There are a lot of ways to properly install PostgreSQL, the fastest and by far easiest is to just use the Postgres App. I prefer to install it using brew:
brew install --cask postgres-appJust installing the Postgres App is almost enough to get full PostgreSQL functionality on macOS. However, the PostgreSQL command line tools (psql, pg_dump, etc.) are not automatically exposed to the shell. To expose them, just add the bin folder from the PostgreSQL App into your path.
I just added this, into my .zshrc, but it should also work for bash or fish!
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin