Here is a way that I've found to install Postgres gems on Leopard Mac OS X :
# gem install postgres -- --with-pgsql-include-dir=/usr/local/pgsql/include --with-pgsql-lib-dir=/usr/local/pgsql/lib
It will launch a lot of errors, no worries, let's work that around :
First, set the enviroment variable :
# export ARCHFLAGS="-arch i386"
Go to the directory :
# YOUR_RAILS_INSTALL_DIR/.gem/ruby/1.8/gems/ruby-pg-0.7.9.2008.01.28/ext
Execute the following :
# ruby extconf.rb --with-pgsql-include=/usr/local/pgsql/include --with-pgsql-lib=/usr/local/pgsql/lib
(Change the PostGres installation directory accordingly )
From the sam directory execute :
gem install ruby-pg -- --with-pgsql-include-dir=/usr/local/pgsql/include/ --with-pgsql-lib-dir=/usr/local/pgsql/lib/
( This will install the postgres gems manually )
You should be good at this point.
Hope that helps.