There are a few ways of setting up Postgres on MacOS.

This is what I found worked best for me:

  1. Install postgres via Homebrew - brew install postgresql@16
  2. Start Postgres server - brew services start postgresql@16
  3. Check service is running - brew services list
  4. Add PostgreSQL to PATH - echo 'export PATH="/opt/homebrew/opt/postgresql/bin:$PATH"' >> ~/.zshrc
  5. Reload the shell - source ~/.zshrc
  6. Verify psql command - psql --version
  7. Add a postgres user - createuser -s -r postgres
  8. Connect to the default postgres database psql -d postgres
  9. Create a password for the postgres user - ALTER USER postgres WITH PASSWORD ‘password’; (replace password with your selected password)
  10. Install pgAdmin
  11. Open pgAdmin and connect to the local Postgres sever (enter password when asked)

If anyone has a better way of doing this, please feel free to let me know. It took some trial and error to get this working for myself.