Running PostgreSQL on OSX

Pico Pico

  • Install with homebrew: brew update ; brew install postgres
  • Initialize: postgres -D /usr/local/var/postgres
  • Create DB for current user (using backticks): createdb 'whoami'
  • Verify that you can login: psql
  • (optional) Configure DB to start on system boot:

    mkdir -p ~/Library/LaunchAgents
    ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
  • Setup a user: /usr/local/Cellar/postgresql/9.5.2/bin/createuser -s postgres
  • Put cool shit in ur DB
Published May 26, 2016