Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

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

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

add comment

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
share|improve this answer
add comment

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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