I was finally able to get my ruby/rails environment setup with my database of choice.
It wasnt easy as postgres will not build with more than one architecture at a time, I had gone through similar hell the last time I tried to build anything on OSX that had to compile against libraries made for different architectures. Fortunately the solution was relatively simple.
My database is running 64 bit and I use it for many other applications that are compiled against either multiple architectures including 64bit but also some which are 64 bit only.
Ruby on the other hand is compled for 32 bit which worked flawlessly on mysql and most of the other gems i installed when I got to the postgres it puked in weird ways and when I tried every third solution on the net it was always the same.
Bash-3.2# gem install pg Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension.
The bottom line from one of the only success stories that I found on the net was that you either built everything 64bit or nothing. Easy enough if you want to build all of your dependencies by yourself. The whole point of gems is to have the tools work for you. I wasnt really able to figure this out in the web full of people beating their heads on the same problem each harder than the other and each reaching the same it doesnt work conclusion but I had the fortune of getting completely away from the web long enough to realize that only the client and libraries needed to match the architecture and since all interaction between rails and the database went through a socket the architecture of the client didn’t have to be the same as the database.
so going back to my postgres source tree i did a
...postgresql-8.3.6# make distclean
and then reconfigured the database using the prefix /usr/local32
..postgresql-8.3.6# ARCHFLAGS='-arch i386' ./configure --prefix=/usr/local32/
Then I just had to tel ruby/gem to use the 32 bit libraries. Since ruby uses pg_config I made sure that the 32bit version is in the path first.
# PATH=/usr/local32/bin/:$PATH ARCHFLAGS='-arch i386' gem install pg -- --with-pgsql-dir=/usr/local32/
And we are off but my god what at PITA.