I've installed it. I see it running. I just can't figure out how to stop it. Or start it again.

Any good references on the net? All I've found is admin apps I have to pay for.

link|improve this question
feedback

migrated from stackoverflow.com Jan 18 '10 at 0:09

This question came from our site for professional and enthusiast programmers.

3 Answers

I'm going to assume you installed it using macports. Something like sudo port install postgresql84-server

Typically, to "activate" the server, you'd need to run something like

sudo -u postgres /opt/local/lib/postgresql84/bin/initdb /opt/local/var/db/postgresql84/defaultdb/

to create the database directory. Then use

launchctl load -w /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/org.macports.postgresql84-server.plist

To turn it off permantently, use

launchctl unload -w /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/org.macports.postgresql84-server.plist

Typically after it finishes building and installing, macports will tell you these things.

Finally, to use it, you'll typically want to put it into your path:

export PATH=$PATH:/opt/local/lib/postgresql84/bin

Then you use be able to use normal commands, like

createuser my_user 
createdb -O my_user my_database
psql -U postgres
link|improve this answer
feedback

Was it started through launchd? If it was, then man launchctl is your friend.

link|improve this answer
feedback

pgadminIII is a good administration tool. It's freely available.

http://www.pgadmin.org/download/macosx.php

It doesn't allow you to start and stop the server, but it is a great way to get started without having to know DDL statements. It's also very good for viewing data and running ad-hoc queries.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.