./configure --prefix=/usr/local/pgsql --mandir=/usr/local/man --infodir=/usr/local/info make sudo make install sudo mkdir /usr/local/pgsql/data sudo chown postgres:postgres /usr/local/pgsql/data sudo su - postgres /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data (cd to or replace postgres.log with your desired logfile name and location) /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data > /usr/local/pgsql/log/postgres.log 2>&1 & /usr/local/pgsql/bin/createdb test /usr/local/pgsql/bin/psql test (to shut down the server) /usr/local/pgsql/bin/pg_ctl stop -D /usr/local/pgsql/data -m fast
Postgres source code (at least as of 8.3.1) contains a startup script package for OS X. Go to <pg build dir>/contrib/start-scripts/osx, and run this:
sudo /bin/sh ./install.sh
Your /etc/hostconfig file will also be modified to include the line below. You can set it to -NO- if you don't want Postgres to load when your computer starts up:
POSTGRESQL=-YES-
You can now manually control the server with these:
sudo /Library/StartupItems/PostgreSQL/PostgreSQL start sudo /Library/StartupItems/PostgreSQL/PostgreSQL stop sudo /Library/StartupItems/PostgreSQL/PostgreSQL restart