Rails + PostgreSQL on OSX

Posted by markm Thu, 04 Sep 2008 21:39:00 GMT

I was not able to find simple instructions to get PostgreSQL onto OSX and working with rails. So here is a simple way…

First grab the binary installer from the fine folks at EnterpriseDB .

Then you just need to toss on the ruby gem using:

sudo gem install postgres -- --with-pgsql-include=/Library/PostgreSQL/8.3/include/ --with-pgsql-lib=/Library/PostgreSQL/8.3/lib/

That is it, you should be good to go.

 

– BONUS: Sphinx with PostgreSQL –

Why not a little bonus! Since searching is something you probably want to do then you will need to install something like Sphinx - so if Sphinx is your choice here is the way to get it going. First download the source code and unzip it. From the folder run:

./configure --without-mysql --with-pgsql --with-pgsql-includes=/Library/PostgreSQL/8.3/include/ --with-pgsql-libs=/Library/PostgreSQL/8.3/lib/ make sudo make install

With that done we just need to configure rails. But for info on that you are better off going to railscasts.