After zipping through a painless upgrade to OSX 10.6 Snow Leopard on both my Macs, I found myself banging my head against the wall trying to get my Rails + Postgres stack running again.
There is a lot of great information out there on how to get everything up to 64bit goodness, and I merrily began the uninstall/recompile/reinstall dance. What followed was an excruciating eight hours of trying to get Postgres to compile to 64bit, and the pg gem — or any Postgres adapter for that matter — to link against it.
Long story short: make sure you actually have a 64bit Mac. Let me say that again: make sure your Mac is actually running Snow Leopard in 64bit.
As embarrassing as this, at some point I finally realized that both my Macs used Core Duo chips, not Core 2 Duos – which makes my Snow Leopard a plain-old 32bit installation. Markus Winter on A hat full of sky has a lot of great information on the subject matter, as well as a program that shows you exactly what mode your system is running in, and why.
So, us 32bit cat owners still have to compile pg with
sudo env ARCHFLAGS='i386' gem install pg -- --with-pgsql-dir=/usr/local/pgsql
- just as we had to on 10.5 Leopard.
What I hope to have learned from this:
- Postgres is a fifteen year old project, crafted in ten thousands of man hours by countless programmers all smarter than me
- Next time it tells me it does not want to compile in 64bit, I’ll listen.
3 Responses to “Rails, Postgres, Snow Leopard and 64bit: a word of warning”
I would be interested in learning if you have had any luck with Ruby 1.9.x and the pg gem. I cannot get them gem to compile either 32 or 64 bit. I’ve tried with both a ‘port installed’ server, and a manually compiled server (8.4.1 both times). The issues I have are in a Nov 19 comment here…
http://isitruby19.com/pg
Unfortunately not – sorry. 1.9 is something I haven’t had the time to really look into yet.
All I can say is that PostgreSQL client version too old, requires 7.3 or later is exactly the message that made me bang my head against the wall for a couple hours when I had my 32bit/64bit mismatch.
Have you tried to link your source-compiled Postgres installation against the system-wide Ruby 1.8 (provided your on a Mac), to narrow down whether it really is an issue with 1.9?
My issue was somehow related to RVM, which was how I installed Ruby 1.9.
Removing RVM completely (including the .rvm dir) and reinstalling, and recompiling Ruby 1.9 fixed the issue.
In fact, when I installed the pg gem into Ruby 1.9, I simply did ‘gem install pg’, without any ARCHFLAGS set, and it worked just great.