Documentation is the easiest way to get started with PostgreSQL on the Mac. Open the app, and you have a PostgreSQL server ready and awaiting new connections. Close the app, and the server shuts down.

Whether you're a command line aficionado, prefer GUIs, or just want to start making things with your framework of choice, connecting to is easy.

Upgrading From A Previous Version

Starting with Version, is using semantic versioning, tied to the release of PostgreSQL provided in the release, with the final number corresponding to the individual releases of PostgresApp for each distribution.

Upgrading between bugfix versions (eg. to, or to is as simple as replacing in your Applications directory. Make sure that the app is closed, though.

When updating between minor PostgreSQL releases (eg. 9.3.x to 9.4.x), will create a new, empty data directory. You are responsible for migrating the data yourself. We suggest using pg_dumpall to export your data, and then import it using psql.

Starting with Version, the default the data directory is: ~/Library/Application Support/Postgres/var-9.3

Command-Line Tools

psql is the PostgreSQL command-line interface to your database. Mac OS 10.7 ships with an older version of PostgreSQL, which can be started with the following command:

$ psql -h localhost

When first starts up, it creates the $USER database, which is the default database for psql when none is specified. The default user is $USER, with no password.

PostgreSQL ships with a constellation of useful binaries, like pg_dump or pg_restore, that you will likely want to use. Go ahead and add the /bin directory that ships with to your PATH (preferably in .profile, .bashrc, .zshrc, or the like to make sure this gets set for every Terminal session):


Once your path is correctly set up, you should be able to run psql without a host. (If not, check that the correct version is being loaded in the PATH by doing which psql) creates a PostgreSQL user with your current username ($USER). It also creates a database with this name, which will be the default one psql connects to if you don't specify otherwise.

To create a new database, connect with psql and enter the following:

CREATE DATABASE your_database_name;

To delete it, enter:

DROP DATABASE your_database_name;

You can get a list of all of psql's commands and shortcuts with \?. A complete reference for PostgreSQL is available on the

Man pages ships with man pages. If you've configured your PATH as described above, just type man psql to read the official docs.

GUI Applications

Explore, query, and visualize your data with Induction. Although still in early development, Induction is fast and easy to use, and is our go-to application when working with data.

If you are running Mac OS X 10.8 and enjoy the cutting edge, check out PG Commander.

If you're looking for something more fully-featured and don't mind getting the kitchen sink in the process, check out pgAdmin.

Connection parameters

When using a GUI program, here are the connection parameters you need to enter:

If you need to provide an URL (eg. for Induction), use postgresql://YOURUSERNAME@localhost/YOURUSERNAME

Configuration Settings

Building a web application and want to skip to the part where everything works? Select the connection settings for your language, framework, and library of choice:


Install the pg gem with gem install pg, or just add gem 'pg' to your application's Gemfile and run bundle install. If you run into a problem with finding headers, run the following:

gem install pg -- --with-pg-include=/Applications/

If you are running your application with Foreman, set the DATABASE_URL config variable in .env:


You can learn more about environment variables from this Heroku Dev Center article.


In config/database.yml, use the following settings:

  adapter: postgresql
  database: [YOUR_DATABASE_NAME]
  host: localhost


In or your application code:

set :database, ENV['DATABASE_URL'] || 'postgres://localhost/[YOUR_DATABASE_NAME]'


Install the activerecord gem and require 'active_record', and establish a database connection:



Install and require the datamapper and do_postgres gems, and create a database connection:

DataMapper.setup(:default, ENV['DATABASE_URL'] || "postgres://localhost/[YOUR_DATABASE_NAME]")


Install and require the sequel gem, and create a database connection:

DB = Sequel.connect(ENV['DATABASE_URL'] || "postgres://localhost/[YOUR_DATABASE_NAME]")


Install the psycopg2 library with with pip install psycopg2 or add it to your pip requirements file.


In your, add an entry to your DATABASES setting:

    "default": {
        "ENGINE": "django.db.backends.postgresql_psycopg2",
        "USER": "",
        "PASSWORD": "",
        "HOST": "localhost",
        "PORT": "",


When using the Flask-SQLAlchemy extension you can add to your application code:

from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://localhost/[YOUR_DATABASE_NAME]'
db = SQLAlchemy(app)


In your application code add:

from sqlalchemy import create_engine
engine = create_engine('postgresql://localhost/[YOUR_DATABASE_NAME]')



Make sure your PHP setup has PDO installed (it is enabled by default in PHP 5.1.0 or above), and the PostgreSQL PDO driver is enabled. Then a database connection can be established with:

$dbh = new PDO('pgsql:host=localhost;dbname=[YOUR_DATABASE_NAME]');

Removing Existing PostgreSQL Installations

For best results, you should remove any existing installation of PostgreSQL. Here's a run-down of the most common ways you may have installed it previously:


$ brew remove postgresql


$ sudo port uninstall postgres


In the EnterpriseDB installation directory, open

Included Packages

Each release of comes with the latest stable release of PostgreSQL, as well a few choice extensions. Here's a rundown of what's under the hood:

Installation Directories


Uninstall just like you would any application: quit, drag to the Trash, and Empty Trash. data and configuration resides at ~/Library/Application\ Support/Postgres, so remove that when uninstalling, or if you need to do a hard reset on the database.


If you run into any issues using, your first stop should be the issue tracker on Github. You can also ask @Postgresapp on Twitter.

Additional Resources