How to install PostgreSQL on Mac

Two good ways: Homebrew if you live in Terminal, Postgres.app if you'd rather click.

Option 1: Homebrew

  1. Install Homebrew from brew.sh if you don’t have it.

  2. See which versions are available, then install one (pick the newest stable major):

    brew search postgresql@
    brew install postgresql@18
  3. Start it now and at every login:

    brew services start postgresql@18
  4. Versioned formulas aren’t added to your PATH. Add the line Homebrew prints after install to ~/.zshrc. On Apple silicon it is:

    echo 'export PATH="/opt/homebrew/opt/postgresql@18/bin:$PATH"' >> ~/.zshrc
    source ~/.zshrc

    On an Intel Mac, Homebrew lives in /usr/local instead of /opt/homebrew.

  5. Create a database and connect:

    createdb myapp
    psql myapp

Homebrew’s Postgres creates a superuser with your macOS user name and no password, listening on localhost:5432.

Option 2: Postgres.app

  1. Download Postgres.app from postgresapp.com and move it to Applications.
  2. Open it and click Initialize. A server starts on port 5432.
  3. Optionally add its command-line tools to your PATH, as described on its site.

Check it works

psql -h 127.0.0.1 -p 5432 -d postgres -c 'select version();'

Open it in a GUI

In Gadwal, add a PostgreSQL connection with host 127.0.0.1, port 5432, your macOS user name and database postgres (or the one you created). Use 127.0.0.1 rather than a socket path: App Store apps are sandboxed and can’t use Unix sockets.

Or paste a URL such as postgres://[email protected]:5432/myapp.

Stop or remove

brew services stop postgresql@18
brew uninstall postgresql@18

Data stays in Homebrew’s var folder (/opt/homebrew/var/postgresql@18) until you delete it.