Skip to content

Instantly share code, notes, and snippets.

@rduarte
Created October 6, 2010 17:13
Show Gist options
  • Save rduarte/613703 to your computer and use it in GitHub Desktop.
Save rduarte/613703 to your computer and use it in GitHub Desktop.
ricardoduarte ~ $ sudo brew install postgresql
==> Downloading ftp://ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz
######################################################################## 100,0%
==> ./configure --disable-debug --without-perl --without-php --without-pgsql --p
==> make
==> make install
/usr/local/Cellar/ossp-uuid/1.6.2: 11 files, 364K, built in 17 seconds
==> Downloading http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v9.0
######################################################################## 100,0%
==> ./configure --disable-debug --prefix=/usr/local/Cellar/postgresql/9.0.1 --en
==> make install
==> cd contrib/adminpack; make install
==> cd contrib/dblink; make install
==> cd contrib/fuzzystrmatch; make install
==> cd contrib/lo; make install
==> cd contrib/uuid-ossp; make install
==> cd contrib/pg_buffercache; make install
==> cd contrib/pg_trgm; make install
==> cd contrib/pgcrypto; make install
==> cd contrib/tsearch2; make install
==> cd contrib/vacuumlo; make install
==> cd contrib/xml2; make install
==> cd contrib/intarray; make install
==> cd contrib/pg_upgrade; make install
==> cd contrib/pg_upgrade_support; make install
==> cd contrib/hstore; make install
==> Caveats
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.0/static/install-procedure.html
If this is your first install, create a database with:
initdb /usr/local/var/postgres
If this is your first install, automatically load on login with:
cp /usr/local/Cellar/postgresql/9.0.1/org.postgresql.postgres.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
If this is an upgrade and you already have the org.postgresql.postgres.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
cp /usr/local/Cellar/postgresql/9.0.1/org.postgresql.postgres.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
Or start manually with:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
And stop with:
pg_ctl -D /usr/local/var/postgres stop -s -m fast
If you want to install the postgres gem, including ARCHFLAGS is recommended:
env ARCHFLAGS="-arch x86_64" gem install postgres
To install gems without sudo, see the Homebrew wiki.
==> Summary
/usr/local/Cellar/postgresql/9.0.1: 1220 files, 20M, built in 3.6 minutes
ricardoduarte ~ $ initdb /usr/local/var/postgres
The files belonging to this database system will be owned by user "ricardoduarte".
This user must also own the server process.
The database cluster will be initialized with locale pt_BR.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "portuguese".
creating directory /usr/local/var/postgres ... ok
creating subdirectories ... ok
selecting default max_connections ... 20
selecting default shared_buffers ... 2400kB
creating configuration files ... ok
creating template1 database in /usr/local/var/postgres/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.
Success. You can now start the database server using:
postgres -D /usr/local/var/postgres
or
pg_ctl -D /usr/local/var/postgres -l logfile start
ricardoduarte ~ $ sudo gem install pg
Building native extensions. This could take a while...
Successfully installed pg-0.9.0
1 gem installed
Installing ri documentation for pg-0.9.0...
Installing RDoc documentation for pg-0.9.0...
ricardoduarte ~ $ psql postgres
psql (9.0.1)
Type "help" for help.
postgres=# CREATE USER postgres SUPERUSER;
CREATE ROLE
postgres=# CREATE DATABASE gtagestor_development OWNER postgres;
CREATE DATABASE
postgres=# ALTER ROLE postgres WITH PASSWORD 'postgres';
ALTER ROLE
postgres=# \q
ricardoduarte ~ $ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
server starting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment