Skip to content

Instantly share code, notes, and snippets.

@rodcisal
Created October 8, 2012 07:10
Show Gist options
  • Save rodcisal/3851146 to your computer and use it in GitHub Desktop.
Save rodcisal/3851146 to your computer and use it in GitHub Desktop.
start/stop postgresql in development
Startup/Shutdown
Next, as the instructions suggest you can set Postgres to start and stop automatically when your mac starts. Run these three commands to have this happen (Postgres will start when you run the last command so there is no need to manually start it if you do this):
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.0.4/org.postgresql.postgres.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
I’ve done this because I use Postgres for all my personal projects. If you’re just experimenting and want to control when it is running you can start and stop Postgres with these commands (perhaps with a shell alias). EDIT: Someone on the Hacker News thread suggested Lunchy for managing launchctl stuff, I’ve not tried it, but it looks useful.
Start Postgres:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Stop Postgres:
pg_ctl -D /usr/local/var/postgres stop -s -m fast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment