When I was poking around to see what was installed, I found psql in
/usr/bin/psql
and I had taken that to mean that I already
had PostgreSQL installed. However, looking at the listening ports and
in the socket directory, I don’t see any evidence of a running
server. Hmmm……
Googling around it appears that the Lion Server may have the full PostgreSQL server running but my laptop seems to only have the psql client installed. OK let’s whip out homebrew. There appear to be formulas for versions 8 and 9 - but the default is now 9 so:
That compiled and installed PostgreSQL 9.1.4. Then I followed the instructions given at the end of the install:
The initdb had a couple of interesting messages. First, The
files belonging to this database system will be owned by user "cnk".
This user must also own the server process.
Ok that isn’t a
problem - on a laptop anyway. And it also warned me that it was
enabling "trust" authentication for local connections
.
The notes in /usr/local/var/postgres/pg_hba.conf warn me that local
“trust” authentication means that any local user can connect as any
databases user - including the database superuser. Again more
permissive than I generally am, but probably OK - and certainly
convenient - as long as I am only accepting connections from localhost.
The next useful piece of information from the brew install script was how to have PostgreSQL start up when I log in:
Homebrew also shows it’s Ruby leanings by helpfully suggesting the compile flags I may want when installing the pg ruby gem. Since I may want this available to me in a variety of gemsets, let’s see if I can just install it in the global gemset for Ruby 1.9.3 (the only Ruby I have installed at the moment).
OK so now that we are installed and running, let’s log in: