To use my favourite open source database, I installed PostgreSQL version 8.2.5 from the source code on my mac. In doing so I followed these instructions, taking into account what suited best my personal preferences:
- http://acts-as-blog.net/2007/11/4/postgresql-auf-mac-os-x-10-5 (in german)
Both articles reflect the changes in Leopard concerning the runtime administration of system services:
- The directory /etc/rc.d is now definetely deprecated. For starting and stopping system services launchd(8) and its controlling-facility launchtl(1) are the tools of choice.
- The NetInfo database and its manager are history as well (at least as far as Leopard is concerned). Hence users and groups which are virtual and only of some system specific interest, and therefore should not show up on the login screen, have to be created and maintained in Leopard's Open Directory with the dscl(1) command.
The second article offers a script for having PostgreSQL started
automatically by launchd, but it doesn't work for me: After rebooting
the machine postmaster (the database server process) didn't start again.
The logfile said, that it could be running already because the lockfile
postmaster.pid in PostgreSQL's data directory was still there. I had it
installed under /usr/local/pgsql with the subdirectory data therein. So
I deleted the .pid file (via sudo), but postmaster did not start, this
time complaining about insufficient rights in the directory. In fact as
the user _postgres I was not allowed to create any file in the
directory although the rights mask said "drwx------" as it should be
with the directory belonging to user _postgres. Funny. Finally I worked
around the problem by initializing a new data directory under
/Users/Shared/PostgreSQL (and hence created a mixture of the two above
mentioned recipes). Then postmaster could start again, but the problem
remains that in case of a system shutdown the process seems not to be
able to clean things up. Hence I wrote two simple scripts to start and
stop PostgreSQL on demand (giving only the first here):
sudo -u _postgres pg_ctl -D /Users/Shared/PostgreSQL/data start
So, if someone could enlighten me, what went wrong - especially with the missing rights phenomenon, and on gracefully stopping system serivces by launchd, please do. I would appreciate it very much.
[Update]: Just after finishing the post, I found the following link in the first cited article's comments: http://www2.russbrooks.com:8080/2007/11/4/ install-postgresql-on-mac-os-x-10-5-leopard which in turn includes a link to http://www.postgresqlformac.com/ (for those behind a firewall not allowing access to port 8080), offering an installer with a precompiled binary and taking the burden of installing from the sources.Go Top