2. Chapter 15. Installation from Source Code

$ brew update
$ brew search postgresQL
postgresql     postgresql8    postgresql9    postgresql91   postgresql92

$ brew install postgresql --no-tcl # fail

[/tmp]$ brew install postgresql92 --no-tcl
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
==> Downloading
Already downloaded: /Library/Caches/Homebrew/postgresql92-9.2.4.tar.bz2
==> Patching
patching file src/pl/plpython/Makefile
patching file contrib/uuid-ossp/uuid-ossp.c
==> ./configure --prefix=/usr/local/Cellar/postgresql92/9.2.4 --datadir=/usr/local/Cellar/postgresql92/9.2.4/s
==> make install-world
==> Caveats
initdb /usr/local/var/postgres -E utf8    # create a database
postgres -D /usr/local/var/postgres       # serve that database
PGDATA=/usr/local/var/postgres postgres   # …alternatively

uilds of PostgreSQL 9 are failing and you have version 8.x installed,
may need to remove the previous version first. See:

igrate existing data from a previous major version (pre-9.2) of PostgreSQL, see:

 machines may require provisioning of shared memory:

When installing the postgres gem, including ARCHFLAGS is recommended:
  ARCHFLAGS="-arch x86_64" gem install pg

To install gems without sudo, see the Homebrew wiki.

To have launchd start postgresql92 at login:
    ln -sfv /usr/local/opt/postgresql92/*.plist ~/Library/LaunchAgents
Then to load postgresql92 now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql92.plist
Or, if you don't want/need launchctl, you can just run:
    pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
==> Summary
  /usr/local/Cellar/postgresql92/9.2.4: 2831 files, 38M, built in 2.8 minutes

Casiano Rodriguez León 2015-06-18