PostgreSQL en MAC OSX

Descargar el paquete de acá:
http://www.kyngchaos.com/software:postgres

Y si queres tambien la extensión PostGIS.

Esto descarga un dmg. Instalaro nomás. Ojo que por lo menos debes tener osx 10.6 y cpu de 64 bits.

Ver el log:
   sudo tail -f /usr/local/pgsql/var/postgresql-2012-09-21.log

Probar si te podes conectar estando logueado con tu user:
   psql -U postgres -h localhost

Tuve algunos problemas y pensé que no andaba, pero al final si andaba.

Probé de setear el password para el usuario “_postgres”:
  sudo passwd _postgres

Probé de darle un shell al usuario _postgres para poder loguearme como el
   $ dscl . -read /Users/_postgres UserShell

        UserShell: /usr/bin/false
   $ sudo dscl . -create /Users/_postgres UserShell /bin/bash

Después me loguee con ese user y traté regenerando la master data base
     /usr/local/pgsql-9.1/bin/initdb -U postgres -D /usr/local/pgsql-9.1/data –encoding=UTF8 –locale=en_US

Starting and Stopping

Startup is automatic on system startup.  It is controlled by a launch daemon in /Library/LaunchDaemons.

If you need to manually start Postgres for any reason and don’t want to restart your Mac, type this in a Terminal as an admin user (enter password when asked):

sudo launchctl load /Library/LaunchDaemons/org.postgresql.postgres.plist

If you want to stop Postgres, make sure all connections are closed, then type this in a Terminal as an admin user:

sudo launchctl unload /Library/LaunchDaemons/org.postgresql.postgres.plist

NOTE: While the load command starts Postgres, technically it’s just loading the plist and following the instructions to start Postgres.  If you try to load the plist and it tells you it’s already loaded, that doesn’t mean Postgres is also running.  If Postgres was stopped with some other method, you need to unload the plist before loading it again.

Disable the automatic startup

To disable the automatic startup of Postgres (this also stops Postgres if running, and all connections are closed):

sudo launchctl unload -w /Library/LaunchDaemons/org.postgresql.postgres.plist

To re-enable the automatic startup of Postgres (this also starts Postgres):

sudo launchctl load -w /Library/LaunchDaemons/org.postgresql.postgres.plist

Using postgreSQL command line client

Create a database: createdb bedrock
(As Linux user postgres)

Don’t Stop Here

More To Explore