In some installations the PostgreSQL8 Unified installer will fail to properly initialize the database. Under normal circumstances, the database is started as part of the installation process. If it is not running after installation, a failure in the database initialization is the most likely reason.
Check the Log file and Folder
By design, the PostgreSQL8 installer attempts to create a log file that is usable by the Apple Console.app log viewer. It does so by creating a Log folder within the PostgreSQL8 folder. That folder should contain a file named PostgreSQL8.log. If either is missing, they need to be created. The quick way is to open Terminal and type the following:
mkdir /Library/PostgreSQL8/log sudo touch /Library/PostgreSQL8/log/PostgreSQL8.log sudo chown -R postgres:admin /Library/PostgreSQL8/log
What this does is first, create the folder, then create the log file itself, and finally set the permissions to what they need to be for everything to work correctly.
In order to make sure that the log is viewable in Console.app, use the following command in Terminal to tie the two together:
ln -s /Library/PostgreSQL8/log/PostgreSQL8.log /Library/Logs/PostgreSQL8.log
Check the Data Folder
Again, looking in the PostgreSQL8 folder, there should be a data folder. If it is not present, then there is no database for the engine to work with. That needs to be created. Again, using Terminal, we run a couple of commands to generate the database:
mkdir -p /Library/PostgreSQL8/data chown -R postgres:postgres /Library/PostgreSQL8/data su -m postgres -c '/Library/PostgreSQL8/bin/initdb -E utf8 -D /Library/PostgreSQL8/data'
Like before steps one and two are building the folders and setting permissions. Step three is the magic one. That is the one that builds the base database and templates.
With these steps complete, the database should start using the Preference Pane or Service Manager (if you have an older installation).
StartupItem permissions
There is a possibility that the startupitem permissions are not correct. This situation will cause the service to not start and on 10.4 or newer, it will raise an error during startup. It is a quick fix from the Terminal:
sudo bash chown -R root:wheel /Library/StartupItems/PostgreSQL chmod -r 0644 /Library/StartupItems/PostgreSQL chmod -0755 /Library/StartupItems/PostgreSQL/PostgreSQL exit
It Still Doesn't Start!
If you get here and it still doesn't start, Console.app is the place to look. In it, find the PostgreSQL8.log and look at it's contents. It will generally spell out exactly why the system failed to start. If you don't have any ideas based upon that, you can send us the contents, and we should be able to get you an answer fairly quickly.