Skip to content

Instantly share code, notes, and snippets.

@gbenedict
Created April 19, 2013 01:07
Show Gist options
  • Save gbenedict/5417415 to your computer and use it in GitHub Desktop.
Save gbenedict/5417415 to your computer and use it in GitHub Desktop.
Fixing a homebrew install of Postgres that won't start.
sudo mkdir /var/pgsql_socket/
sudo ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/
# initialize the database
initdb /usr/local/var/postgres -E utf8
# start your database
pg_ctl -D /usr/local/var/postgres/data -l logfile start
# setup a db and user for the current Mac user
createdb $USER
createuser -s -U $USER
# go create application databases
createdb app_d
# go backup a database from heroku and restore it locally.
heroku pgbackups:capture -a app --expire
curl -o ~/Downloads/app.dump `heroku pgbackups:url -a app`
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d app_d ~/Downloads/app.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment