However I’ll be using DarwinPorts (or MacPorts as its now known) instead of fink. In fact you may ask why don’t I just install the Darwin port of Postgres? When it comes to critical apps which are important to me I always prefer to use the source and therefore can apply any compilation settings that I may need.

Here’s the steps I went thru (via Terminal session). DarwinPorts being installed is a prerequisite….

First off u must become root. You can do this from an admin account with just “sudo -s“.

Next we must install some ports that Postgres will need….
port install readline
port install gmake
port install bison

Then we need to create a /usr/local directory (mkdir /usr/local). Within this we need a “src” directory where we can download the Postgres source code to (cd /usr/local ; mkdir src ; cd src).

Now you in a position to compile the source code. Go into the Postgres directory that was unpacked and do the following steps….
./configure --with-includes=/opt/local/include/ --with-libraries=/opt/local/lib --with-bonjour
gmake
gmake install

PostgreSQL as now been compiled and installed. Next step is to initiate the database storage area. For this you will need to create a “postgres” account on your Mac. (If unclear then read instructions in the article on how to do this). Then do this…..
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su -l postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

We now have a fully working PostgreSQL RDBMS on your Mac.

Next you want to put the following in your login .profile (for the postgres account)….

About…..

My name is Barry Walsh. I'm a freelance IT consultant from London, UK. [more]

This blog is mostly about Perl programming because this is what I use and love (and occasionally hate!) for the majority of my working (and sometimes non-working) day.

Occasionally I will touch on other subjects like PostgreSQL, Mac OSX, UNIX, Linux, Ruby, jQuery, Javascript, XML and many more techie things that I also play with regularly. Other non techie aspects of my life may slip in now and again but I'll try and keep that to a minimum because its normally boring anyway :)