Install Postgres and have it load on startup
sudo port install postgresql92-server
sudo port load postgresql92-server
sudo mkdir -p /opt/local/var/db/postgresql92/defaultdb
sudo chown postgres:postgres /opt/local/var/db/postgresql92/defaultdb
sudo mkdir -p /opt/local/var/log/postgresql92
sudo chown -R postgres:postgres /opt/local/var/log/postgresql92
sudo su postgres -c '/opt/local/lib/postgresql92/bin/initdb -D /opt/local/var/db/postgresql92/defaultdb'
sudo su - postgres
/opt/local/lib/postgresql92/bin/pg_ctl -D /opt/local/var/db/postgresql92/defaultdb -l /opt/local/var/log/postgresql92/logfile start
Add user 'fitacular' as superuser
/opt/local/lib/postgresql92/bin/createuser -s fitacular
You can now log out of postgres user (hit ctrl-d
)
/opt/local/lib/postgresql92/bin/createdb fitacular -U fitacular
/opt/local/lib/postgresql92/bin/psql -U fitacular
Add to your path, at least for now (can add to .bashrc or .zshrc to make it easier later)
export PATH=/opt/local/lib/postgresql92/bin/:$PATH
Make sure 'pg' gem is right, by uninstalling first!
gem uninstall pg
Get git changes and head to db branch
git checkout db && git pull
install pg gem with right extensions
bundle
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake db:populate
Now you're running with PG