So I successfully installed PostgreSQL 9.1 on MacOSX Lion. Unlike people say, I didn't have to change the PATH and no other version of PostgreSQL was installed on the system ($ psql --version shows psql (PostgreSQL) 9.1.4).

However, when I try to run the server with pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start it doesn't work. First, it says no dir /usr/local/var/postgres/ exists. Fine, created one. Then it says the permissions are wrong - fine, changed them. Then it requires postgresql.conf file to be in this dir.

Now, I found sample configs in /usr/local/Cellar/postgresql/9.1.4/share/postgresql, but I'm not sure this is what it's supposed to be like. All the manuals I've seen on the web did not mention creating config files out of samples. Shouldn't homebrew be providing this out of the box, so that I simply start the server right away?

  • If you feel it should, submit a new issue – I've personally never installed it, so I can't say whether this is intended or not.
    – slhck
    Jun 28, 2012 at 10:30

1 Answer 1


Is this your first install? Have you tried to run initdb /usr/local/var/postgres? That just solved the same issue, which has just happened to me after clearing an old system-wide PostgreSQL install and reinstalling it using Homebrew.

Running brew info postgres is always useful as a reminder of the commands available after installing a package.

postgresql 9.1.4
Depends on: readline, ossp-uuid
/usr/local/Cellar/postgresql/9.1.4 (2751 files, 36M) *

==> Caveats
# 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:

To build plpython against a specific Python, set PYTHON prior to brewing:
  PYTHON=/usr/local/bin/python  brew install postgresql

# Create/Upgrade a Database

If this is your first install, create a database with:
  initdb /usr/local/var/postgres

To migrate existing data from a previous major version (pre-9.1) of PostgreSQL, see:

# Start/Stop PostgreSQL

If this is your first install, automatically load on login with:
  mkdir -p ~/Library/LaunchAgents
  cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
  launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

If this is an upgrade and you already have the homebrew.mxcl.postgresql.plist loaded:
  launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
  cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
  launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.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

# 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:

For more information on the CREATE EXTENSION command, see:
For more information on extensions, see:

# Other

Some machines may require provisioning of shared memory:

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.
  • 1
    I guessed that this existed, but I did not know about it. brew info blah. This is fantastic! Thanks. :)
    – chandsie
    Jan 7, 2013 at 4:34
  • As of June 2014, brew info postgres no longer provides the helpful info on CREATE EXTENSION - so for me it was helpful to see it here.
    – user12345
    Jun 23, 2014 at 2:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.