Skip to content

Instantly share code, notes, and snippets.

@Swop
Created November 18, 2013 22:01
Show Gist options
  • Save Swop/7536181 to your computer and use it in GitHub Desktop.
Save Swop/7536181 to your computer and use it in GitHub Desktop.
brew install postgresql
initdb /usr/local/var/postgres -E utf8
gem install lunchy
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.3.1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents
lunchy start postgres
lunchy stop postgres
# TIPS 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
# 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 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