PostgreSQL 8.4 Installation on Mac OS/X 10.5.7
Dan Bikle -- http://bikle.com -- 2009-07-24

I just finished installing PostgreSQL 8.4 on my Mac which is running OS/X 10.5.7.

I wrote some notes and captured some screenshots along the way.

I started with a google of "PostgreSQL download" and it sent me here:

http://www.enterprisedb.com/products/pgdownload.do

I saw:

The download gave me a click-able object and a README file:

The README discussed the file /etc/sysctl.conf and how to edit it. I edited my /etc/sysctl.conf file and now it looks like this:

kern.sysv.shmmax=1610612736
kern.sysv.shmall=393216
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.maxprocperuid=512
kern.maxproc=2048
After I edited /etc/sysctl.conf, I rebooted my Mac.

Then I clicked on the click-able object and this window came up:

It is grayed-out because my image capture program was active when I captured the image.

After I clicked next, I dealt with a series of forms:

I checked the process list on my Mac:

Next, I looked at the directory where the software landed:

I made a note of where the uninstaller was located:

I then noticed that some new GUI applications were installed in the OS/X Applications folder:

I clicked on the pgAdmin utility:

At this point I was convinced that PostgreSQL was installed.

Next, I focused my attention on the task of connecting it to Ruby on Rails.

I started the task by sending some keywords to google:
"ruby rails postgresql database.yml"

I did some reading:

I did some more reading:

I did some more reading:

I tried and failed to "gem install pg":

Oops I forgot to add a token to my path so rubygems could find the pg_config utility.

Here was my fix:

I tried again to "gem install pg":

Since that failed I decided to try to "gem install postgres":

I struggled a bit to find the solution. I captured a screen during that effort:

Well the fix to the problem of rubygems getting confused by libxml2.2.dylib was for me to unset the environment variable: DYLD_LIBRARY_PATH. I had set it a few weeks before during some work I had done with Oracle Instant Client. I am not using Oracle Instant Client now so I don't really need to have DYLD_LIBRARY_PATH set to a value:

Next, I ran a rails command to create a Rails application which wanted a PostgreSQL connection:

I looked in the config directory for the database.yml file which contains syntax I wanted to study:

I noticed that the password was blank. Perhaps there is a way to connect to the database without a password? Oracle offers this ability as a security feature. Perhaps PostgreSQL offers this feature also? I searched the web and found that PostgreSQL offers this feature.

The feature is controlled by a file named pg_hba.conf:

The file has a description of the feature as well as the configuration directives to implement it:

On my Mac, pg_hba.conf was/is configured to require connection to PostgreSQL with a password:

Notice the tokens "md5". They direct this configuration. If I change them to "trust", I will be able to connect with no password assuming I pass the other filters listed as: TYPE, DATABASE, USER, CIDR-ADDRESS

Next, I studied the database.yml file. Then I created a database to match it using a shell command:


createdb pgsql10_development

Next, the database.yml file suggested that I needed a user named pgsql10. How do I create pgsql10? Ask google:

Then issue a shell command:


createuser pgsql10

Next, I told Rails that I wanted the password to be the single letter: "p"

Then, I told PostgreSQL that I wanted the password to be the single letter: "p"

Then, I tested the connection between Rails and PostgreSQL with the shell command, script/dbconsole:

I created a table, inserted some data, and then dropped the table:

I get out of that CLI with the \q command:

I tested the Rails-PostgreSQL connection more by creating a scaffold, running a migration and then creating an AR object:

Next, I returned to pgAdmin utility to see if my new database, user, and table was in there somewhere:

Yes, indeed. I see them in there!