Skip to content

Instantly share code, notes, and snippets.

@i-blis
Created April 12, 2014 22:54
Show Gist options
  • Save i-blis/bbec9ec2d050093db793 to your computer and use it in GitHub Desktop.
Save i-blis/bbec9ec2d050093db793 to your computer and use it in GitHub Desktop.
Hints for PostgreSQL use on OS X

Starting and stopping PostgreSQL server

Start, and stop, manually:

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
pg_ctl -D /usr/local/var/postgres stop -s -m fast

Or let launchd start the server at login or boot:

ln -sfv /usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents # or /Library/LaunchAgents for start at boot
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Loading extensions

Homebrew builds all available contrib extensions. To see a list of available extensions run from the psql command line:

SELECT * FROM pg_available_extensions;

To load any of the extensions, for instance cube, in the current database:

CREATE EXTENSION cube;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment