Skip to content

Instantly share code, notes, and snippets.

@guncha
Created December 1, 2014 01:18
Show Gist options
  • Save guncha/392fee6eac19908fd770 to your computer and use it in GitHub Desktop.
Save guncha/392fee6eac19908fd770 to your computer and use it in GitHub Desktop.

Auto-start PostgreSQL server on OSX with Homebrew

Below plist should go into ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist. LaunchAgent should pick it up on restart.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>KeepAlive</key>
  <true/>
  <key>Label</key>
  <string>homebrew.mxcl.postgresql</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/postgres</string>
    <string>-D</string>
    <string>/usr/local/var/postgres</string>
    <string>-r</string>
    <string>/usr/local/var/postgres/server.log</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>WorkingDirectory</key>
  <string>/usr/local</string>
  <key>StandardErrorPath</key>
  <string>/usr/local/var/postgres/server.log</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment