Max Glenister

Software & Servers • 3 min read Plain text

Making Postgres work nicely on OS X Mountain Lion

Postgres on OS X has been a pain in the ass for as long as I have had to use it.

To start with, the version that comes with OS X is old, so I’ve always had to replace it with a better version.

Usually this entails completely eradicating the existing version system-wide, and then installing a newer version using homebrew. It’s not enough to just install postgres using homebrew though, you have to add launchctl scripts, recite some ancient enchantments, and sacrifice your first born to get anything to work or to start when the system boots.

For a while, this method was fine, I had all of my postgres databases working fine across all of my virtualenv’s, I was happy. Then I made the decision to update things using brew. Big mistake, brew (smartly) installs each version of a program in its own version specific folder. Unfortunately, this means any symbolic links I have to the brewed postgres binaries would be rendered broken if I upgrade postgres, and remove the old version.

After struggling with this farcical exercise for the best part of a year, and vocalising my problems at various hack days, on IRC, etc. people suggested Postgres.app.

Postgres.app is magical, it’s a completely isolated/packaged version of postgres, contained in an app. If you want to upgrade it, no problem, you just replace the app, all paths stay the same.

There was a bit of voodoo needed to make it work well though, such as symlinking the psql binary contained within Postgres.app to my /usr/bin directory.

Eventually I came across another problem, psql couldn’t run. No indication of how or why it wouldn’t work, nothing in the logs (they’re disabled by default for the postgres in Postgres.app).

It turned out the problem is related to how much memory psql requests to run, and how much OS X actually allocates. In versions of postgres that are <9.3 this is quite high, but I’ve read that in 9.3 and up they’ve changed the memory requirement.

If you’re using an older version of postgres, and you’re having trouble with psql not starting you can do one of two things:

Temporarily adjust the memory available for postgres

$ sudo sysctl -w kern.sysv.shmall=65536
$ sudo sysctl -w kern.sysv.shmmax=16777216

or, permenantly adjust the memory available for postgres, by editing /etc/sysctl.conf and adding the following lines:

kern.sysv.shmall=65536
kern.sysv.shmmax=16777216

That seemed to fix everything for me, and now psql works with no issue.

  • Software & Servers · shares #database
    Installing MySQL on OS X Mountain Lion

    I was having some issues getting MySQL installed on OS X 10.8 Mountain Lion, and then I came across a useful article describing how to do it.

    August 2012 • 1 min read
  • UX & Design · shares #macos
    Making GIMP feel less like punishment

    GIMP has always had an interface problem. I’m not blaming the GIMP team (they’ve built something powerful on a shoestring). They’ve been clear they’re not interested in copying Photoshop wholesale; their FAQ argues that designing around actual user research beats imitating someone else’s interface decisions. Fair enough in principle, but coming from years as a Photoshop user, that design still feels hostile to me. I’m just one user story out of many they’ve had to design for, but it still expects me to learn its own way of doing things rather than offering a config closer to what I’m used to out of the box.

    June 2026 • 2 min read
  • Software & Servers · shares #guide
    Replacing the macOS audio switcher with SwiftBar

    The built-in audio output menu in macOS has always felt a bit limited. The icons aren’t very helpful, the device names can’t be customised, and if you’ve got a few different outputs, it becomes tricky to quickly tell what’s what.

    October 2025 • 3 min read

Discussion

No interactions yet

Join the conversation

Reply from your own site with a Webmention (how?).

Webmentions last fetched 14 November 2026, 10:07