Postgres.app

The easiest way to get started with PostgreSQL on the Mac

PHP

PDO

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:

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

The default PHP that comes with OS X 10.9 does not have Postgres support. The easiest way to use PHP with Postgres is to use MAMP.