Installing PostgreSQL on Mac OS X

Suggest edits

EDB provides MacOS installers for PostgreSQL on the EDB downloads page. These installers simplify setting up a system.

For a detailed walk-through of the installation process on Mac OS, see this tutorial.

Command-line tools

After installing PostgreSQL, you can run command-line tools by referencing them in the bin directory under the installation path you specified during installation. For example, to run psql from the default installation directory, enter:

/Library/PostgreSQL/12/bin/psql -U postgres

For ease of use, you can add this directory to your PATH by adding a line to your ~/.bash_profile. If using zsh, add it instead to ~/.zshrc.

export PATH="/Library/PostgreSQL/12/bin/:$PATH"

This step is especially important if you plan to use scripts or other software that rely on PostgreSQL tools, such as Python's psycopg2. You can instead add this directory to the system path.

Several other options for installing PostgreSQL on MacOS offer varying levels of flexibility, version support, add-ons, and so on. You find more details on the PostgreSQL website.


Could this page be better? Report a problem or suggest an addition!