I recently setup my development system from scratch and one of the tasks is installing PostgreSQL as my apps are almost always deployed to Heroku and they <3 PG.

As you may or may not know, Lion ships with a castrated Postgres installation which (if you don’t already know this (!!!!)) can make it challenging to use something like Homebrew for your installation medium.

To avoid this whole situation I suggest you checkout Postgres.app.  It’s written by the guys @ Heroku and is essentially a .app that you drop in your Applications folder.  Run whenever you want a PG server — it’s THAT easy.

Well… Sorta…

After installing it I had some issues but was able to figure it out so that’s really the “gotcha” part of this post.

On first launch i realized i couldn’t connect to the PG server and immediately went to my system’s console for clues.  This was sitting there looking pretty:

 

Ye olde  “Failed system call was shmget” error….

I believe the root of this issue is that OSX’s shared memory configuration is just really small. And after Googling around I found this post on Railscasts.com by Denis Savitsky (aka sadfuzzy).

In a nut shell there are two ways to fix this:

1- Temporary Solution: Gone after reboot.

2- Permanent Solution: Forever, forever, ever, forever, ever? Yep. After reboot the settings will stick.

 

You can also see this post for further details.