Install Postgresql On Mac Os X Via Brew
Install PostgreSQL on Mac OS X via Brew
Akbar S. Ahmed | Feb 21, 2015

Step-by-step instructions

PostgreSQL is an open source object-relational database. It is a popular database choice when using a relational database.

Installing PostgreSQL on Mac OS X is simple.

Software versions

The instructions in this post were created / tested using the following sofware versions:

  • Mac OS X Yosemite 10.10
  • HomeBrew 0.9.5
  • PostgreSQL 9.4

Install PostgreSQL via Brew

First, we will update Brew and then install PostgreSQL.

brew update

brew install postgres

Start PostgreSQL

Start the PostgreSQL server in the foreground. There are optional instructions below in case you would like to start PostgreSQL automatically.

Brew initializes the database during installation.

postgres -D /usr/local/var/postgres

Login to PostgreSQL for the first time.

Press Cmd + T to open a new terminal tab.

whoami is surrounded by backticks, not single quotes.

createdb `whoami`

Login to PostgreSQL with your user account.


Optional: Install AdminPack

AdminPack is used by PgAdmin. If you plan on using the PgAdmin UI, then installing AdminPack is a good idea.

psql postgres -c 'CREATE EXTENSION "adminpack";'

Optional: Configure PostgreSQL to start automatically

The commands below configure PostgreSQL to start automatically.

mkdir -p ~/Library/LaunchAgents

ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist


Congrats. PostgreSQL is now installed on Mac OS X. You are now ready to start using PostgreSQL for development.

Subscribe to our newsletter

Contact Information


We specialize in helping professional developers, like you, expand your skill set. Our courses are focused on enabling you to learn everything necessary to use a new technology in a live, production application.


All courses are made with love in
Palo Alto, CA.

Subscribe to our newsletter