Today as I was installing PostgreSQL 9.04 on a new server I encountered the following error:

\[root@host ~\]# /usr/local/etc/rc.d/postgresql initdb
su: unknown login: %%PG_USER%%

Something obviously went wrong when the port was being installed. Most likely it’s a bug in the build-instructions for the port. No stress though, as there is an easy fix. Just open up _/usr/local/etc/rc.d/postgresql_ and modify the line




(or I suppose you could add “postgresql_user=pgsql” to rc.conf).

You should now be able to initiate PostgreSQL.