Skip to content

Instantly share code, notes, and snippets.

@vladimir-e
Last active December 25, 2015 18:59
Show Gist options
  • Save vladimir-e/7024773 to your computer and use it in GitHub Desktop.
Save vladimir-e/7024773 to your computer and use it in GitHub Desktop.
init postgres
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
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/mxcl/homebrew/issues/issue/2510
To migrate existing data from a previous major version (pre-9.3) of PostgreSQL, see:
http://www.postgresql.org/docs/9.3/static/upgrading.html
When installing the postgres gem, including ARCHFLAGS is recommended:
ARCHFLAGS="-arch x86_64" gem install pg
To install gems without sudo, see the Homebrew wiki.
To reload postgresql after an upgrade:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
initdb /usr/local/var/postgres -E utf8
psql
CREATE USER user SUPERUSER PASSWORD 'pass';
\q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment