Skip to content

Install postgres mac

Install PostgreSQL on Mac

[1] install postgres using brew

  • Run brew install postgres

This will install the latest version of postgres on your computer. For other versions, go to brew's documentation for postgres.

[2] Start server

To start the postgres server, run brew services start postgresql

You can check the running server by typing: brew services list

To stop the server, run brew services stop postgresql

[3] Connect to database

  • To connect to the database, run the following command: psql postgres

The "psql" part start the command line tool for postgres, and the "postgres" tells postgres which database you want to go into. This is the name of the default database created by installing postgres.

[4] Install pgAdmin

  • Navigate to the pgAdmin website to download the application. Click on the latest version and then click on the .dmg file.
  • Once downloaded, run the installer and copy the app into your /Applications directory.

[5] Connect pgAdmin to postgres

  • Launch the pgAdmin application, right-click on the server and choose Create > server...
  • In the General tab, give the server a name (i.e. "local_server")
  • In the Connection tab, write "localhost" for the Host name/address and your username for the Username field. If you are unsure what your username is, log into psql (see step 3), and run \du which will give you a list of users and their roles.

Using PostgreSQL

You can now use the psql command line tool or pgAdmin to maintain and query your databases.

wiki.postgresql.org