Skip to content

Instantly share code, notes, and snippets.

@cpjobling
Created May 2, 2013 09:06
Show Gist options
  • Save cpjobling/5501081 to your computer and use it in GitHub Desktop.
Save cpjobling/5501081 to your computer and use it in GitHub Desktop.
Brew Install PostgresQL
# Build Notes
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/mxcl/homebrew/issues/issue/2510
To build plpython against a specific Python, set PYTHON prior to brewing:
PYTHON=/usr/local/bin/python brew install postgresql
See:
http://www.postgresql.org/docs/9.2/static/install-procedure.html
# Create/Upgrade a Database
If this is your first install, create a database with:
initdb /usr/local/var/postgres -E utf8
To migrate existing data from a previous major version (pre-9.2) of PostgreSQL, see:
http://www.postgresql.org/docs/9.2/static/upgrading.html
# Loading Extensions
By default, Homebrew builds all available Contrib extensions. To see a list of all
available extensions, from the psql command line, run:
SELECT * FROM pg_available_extensions;
To load any of the extension names, navigate to the desired database and run:
CREATE EXTENSION [extension name];
For instance, to load the tablefunc extension in the current database, run:
CREATE EXTENSION tablefunc;
For more information on the CREATE EXTENSION command, see:
http://www.postgresql.org/docs/9.2/static/sql-createextension.html
For more information on extensions, see:
http://www.postgresql.org/docs/9.2/static/contrib.html
# Other
Some machines may require provisioning of shared memory:
http://www.postgresql.org/docs/9.2/static/kernel-resources.html#SYSVIPC
To install postgresql (and ossp-uuid) in 32-bit mode:
brew install postgresql --32-bit
If you want to install the postgres gem, including ARCHFLAGS is recommended:
env ARCHFLAGS="-arch x86_64" gem install pg
To install gems without sudo, see the Homebrew wiki.
You should reload postgresql:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
==> Summary
🍺 /usr/local/Cellar/postgresql/9.2.4: 2831 files, 39M, built in 3.0 minutes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment