The easiest way to install PostgreSQL on a Mac is by installing Postgres.app. Postgres.app is a full-featured PostgreSQL installation packaged as a standard Mac application.
You simply download it and drag it to your Applications folder, just like with any other application.
Install Postgres.app
Here are step-by-step instructions for installing PostgreSQL.app on your Mac.
- Download the latest version of Postgres.app from the Postgres.app website.
- Double-click the .dmg file.
- Drag the Postgres.app icon to your Applications folder.
Done. You’ve just installed Postgres.app.
Create a New Server
To create a new server:
- Double-click the Postgres.app icon (in your Applications folder)
- Click Initialize.
Once you’ve done that, you should see a screen similar to the following:
When you install Postgres.app, several databases are created by default, including one using your system username.
You can start and stop PostgreSQL using the relevant buttons on this panel.
Connect to a Database
To connect to a database, double click one of the database icons shown in the above screen. This will connect to that database using the psql command line interface.
Alternatively, you can launch psql in a separate terminal window and type psql
. This will connect to your default database.
Another alternative is to use a GUI application, such as pgAdmin, DBeaver, Postico, Azure Data Studio, etc.
Configure $PATH
You can also configure your $PATH
to use the included command line tools.
sudo mkdir -p /etc/paths.d &&
echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
Remove Existing Installations
The above instructions assume you don’t already have PostgreSQL running on your Mac. If you do, you’ll run into problems, if both versions are trying to use the same port (5432 is the default port).
It’s recommended that you remove any pre-existing PostgreSQL installations before installing Postgres.app.
See Removing Existing PostgreSQL Installations on the Postgres.app website for instructions on how to do this.