Thomas Fuchs
Hi, I'm Thomas Fuchs. I'm the author of Zepto.js, of, and I'm a Ruby on Rails core alumnus. With Amy Hoy I'm building cheerful software, like Freckle Time Tracking and Every Time Zone and write books like
   Want me to speak at your conference? Contact me!

PostgreSQL on Mac OS X Tiger

May 3rd, 2005

If you go with the best (and you do that by using Mac OS X), you’ll want to use PostgreSQL with your Rails application (and not that other “database”).

So, what’s the deal?

First of all, install Rails on your Mac OS X Tiger system like described on this wiki page. Head straigt for the first option “Mac OS X Installer Package” of you are just starting out with Tiger, or check the other options for your setup.

Next, grab the PostgreSQL package from and follow the installation instructions for Mac OS X 10.3 (don’t mind the .3). If you’re like me, you’ll want full unicode support when creating your db, so change step 6 to something like (that’s all in one line!):

/usr/local/bin/initdb -D /usr/local/pgsql/data
--locale=en_US.UTF-8 --encoding=UNICODE

So, you’ve a nice running PostgreSQL setup on your Mac OS X Tiger box now. But, wait a minute—you want it to use with Rails, right? You want to grab the Ruby PostgreSQL driver from this page (get the snapshot version if you want to stay on the edge).
Follow the compile instructions. You’ll want to do a:

sudo make install

as the last step here. (Note: there’s a Gem version too, but it doesn’t compile out of the box on Mac OS X).

Then, get the Mac OS X native pgAdmin version. Just use the latest snapshot.

Untar, and launch. Have fun!

UPDATE: One thing that bugs me with this is that script/console seems to be broken, as I get a SIGBUS error from ruby-postgres. Webrick and script/runner work fine, though. Has anyone experienced this too?

UPDATE 2: The script/console not working correctly is discussed in greater detail and including a workaround over at the Ruby on Rails development site in ticket 1283.