This type of guide is all over the internet, but I’m too lazy to search for one every time I want to do this. ;) So here’s a brief overview of how I got PostgreSQL set-up nicely on Mac OS 10.5…
Setting Up Our Environment
Using a text editor of your choice, add the following lines to the bottom of the
/etc/profile file (you’ll
need to be an administrator to do this):
# PostgreSQL export PATH=/opt/local/lib/postgresql83/bin:$PATH
Now before we move on, make sure that you have MacPorts installed.
Installing PostgreSQL with MacPorts
I like MacPorts - it makes installing general Unix packages and keeping them up-to-date a snap. As such, we’ll use it to do the heavy lifting for installing PostgreSQL. Open up a terminal and hit up the following command:
Sit back and wait a while… That’s the basic install done.
Now to configure it, do the following:
This installs a default database instance for us to be getting on with. Next, run this command to get PostgreSQL to start on system boot:
Reboot your Mac.
Creating a User Account and Database
Once your Mac is back up, we finally need to create an account for us to use (substitute ‘daz’ for your username)…
Now a database to play with…
Admin Your Database with pgAdmin 3
Download pgAdmin, then run the following commands to set up some functions that allows pgAdmin to collect statistics about your databases:
That’s it - job done!
For notes on making the database accessible over the network, please refer to one of my posts on PostgreSQL on Ubuntu.