Postgresql – Admin Commands Short List

HomeDocs >

Determining if Postgres is Running

ps auxwww | grep postgres

The installation directory generally looks something like this.

/Library/PostgreSQL

However Postgres has and continues to have various disparate installation paths depending on the installation method. Maybe they’ve been synchronized, but I don’t hedge bets on it and just assume I’ll have to find it.

Easy Installations

There is an actual installer for Windows, OS-X, and other platforms available via EnterpriseDB. I’d however advise NOT to use this installer. The more generally accepted installation method is to use homebrew or other alternates on Linux. As for Windows, this is another situation I’d suggest just not running Windows as it would be easier and less frustrating.

With homebrew it’s easy to get a good installation following these steps. It is always good to kick off with a brew update and doctor to make sure things are ok on the system.

brew update
brew doctor

Then give it the ole’ brew install.

brew install postgresql

Now setup the initial database, which you’ll have to do.

initdb /usr/local/var/postgres -E utf8

Now let’s setup launch. Mind you, make sure to check what version of Postgres you’re install as the version below may be different than what I’ve used.

mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.2.1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/

Now run Launch Control.

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

…and that should get everything up and running.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s