Skip to content

Instantly share code, notes, and snippets.

@behboud
Created November 3, 2013 21:22
Show Gist options
  • Save behboud/7294978 to your computer and use it in GitHub Desktop.
Save behboud/7294978 to your computer and use it in GitHub Desktop.
mac postgresql
initdb /usr/local/var/postgres -E utf8 # create a database cluster
postgres -D /usr/local/var/postgres # serve that database
PGDATA=/usr/local/var/postgres postgres # …alternatively
postgres -D /usr/local/var/postgres
postgres -D /usr/local/var/postgres
or
pg_ctl -D /usr/local/var/postgres -l logfile start
To have launchd start postgresql at login:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
Then to load postgresql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Or, if you don't want/need launchctl, you can just run:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment