Installation with Homebrew
Homebrew is the standard method on macOS. The postgresql@17 formula installs the server, the psql client, and the utilities, then runs initdb at install time (per the Homebrew caveats) to create the cluster in the data directory.
The default PostgreSQL user matches your macOS account (not postgres). You can therefore connect directly with psql postgres once the service is started.
Paths by architecture
The Homebrew prefix differs between chips: /opt/homebrew on Apple Silicon (M1/M2/M3…) and /usr/local on Intel Macs. The data and configuration paths shown above assume Apple Silicon; adjust the prefix on Intel.
Common pitfall: binaries outside the PATH
Because it is a versioned formula, postgresql@17 is always "keg-only": its binaries are never linked into the global PATH. You must therefore add the formula's bin directory to your PATH, for example in ~/.zshrc: export PATH="/opt/homebrew/opt/postgresql@17/bin:$PATH".