Search code examples
postgresqlpostgresapp

How can I run two copies of PostgreSQL on Mac OS X?


I need to run integration tests for a system that has both a local and a remote database server; I'd like on my dev Mac to have two PostgreSQL servers on different ports. I usually use Postgres.app - can this be somehow configured to run two instances?


Solution

  • Just call initdb from the binary directory (/Applications/Postgres.app/Contents/Versions/latest/bin/initdb). Pass --help if you wish but initdb only needs a data directory so:

    initdb -D <dir>
    

    Once complete go to your new directory and edit postgresql.conf and change the port.

    Then start up