Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I use built in PostgreSQL?

Am I missing something?

I'm trying to use the built in version of postgresql with OS X Server for Yosemite. Always in the past I've used MySQL but since Apple (for some reason) basically dropped support for it a few years ago I've decided to give Postgres a try.


I have the server app but there are no options that I can find to enable/disable postgres. I've tried from the command line as well but nothing works. The "serveradmin" command is not found and every guide for postgres I've found uses that command. I'd like to just enable something and then log in with a client a manage my tables, etc. as I do with MySQL.


At this point I'm stuck. I can't find a guide anywhere that tells me how to use the built in version of Postgres. They all point to other installation options. There are several ways of installing the standard version on top of the OS but that defeats the purpose of what I'm trying to accomplish. If I wanted to install a database system other than what is already built in, I'd continue using MySQL.



If I can't get this to work, I'd like to know if there is another database I should try. I need something that can be easily installed/removed, doesn't make a mess of the file system, is natively compatible with OS X, and easily connectible with PHP. I know there are probably a few paid options like Oracle, but I'd prefer something free and open source.

Posted on Aug 1, 2015 9:00 AM

Reply
2 replies

Aug 1, 2015 4:59 PM in response to jhamer05

There is no longer any provision in the server tools for starting a PostgreSQL process other than the ones reserved for built-in services. You have to do it on your own. Create a launch daemon with content such as the following:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<dict>
<key>Label</key>
<string>org.postgresql.postgres</string>
<key>UserName</key>
<string>_postgres</string>
<key>GroupName</key>
<string>_postgres</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Server.app/Contents/ServerRoot/usr/bin/postgres</string>
<string>--apple-configuration</string>
<string>/Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist</string>
</array>
<key>KeepAlive</key>
<dict>
<key>PathState</key>
<dict>
<key>/Library/Server/PostgreSQL/Data</key>
<true/>
</dict>
</dict>
<key>StandardErrorPath</key>
<string>/Library/Logs/PostgreSQL/PostgreSQL.log</string>
<key>StandardOutPath</key>
<string>/Library/Logs/PostgreSQL/PostgreSQL.log</string>
</dict>
</plist>
<plist version="1.0">

Also create these directories and files, owned by _postgres:_postgres:

/Library/Logs/PostgreSQL
/Library/Server/PostgreSQL
/Library/Server/PostgreSQL/Backup
/Library/Server/PostgreSQL/Config
/Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist
/Library/Server/PostgreSQL/Data

Finally, initialize the database with a suitable invocation of initdb(1).

For more details, see the PostgreSQL documentation. You may find it easier to use a packaged third-party distribution independent of the built-in one.

How do I use built in PostgreSQL?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.