Created
January 20, 2012 01:34
-
-
Save metaphox/1644401 to your computer and use it in GitHub Desktop.
Fixing the postgresql initdb fatal shared memory error on Leopard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixing the postgresql initdb fatal shared memory error on Leopard | |
Published Tue 18 December 2007 11:09 (+1300) | |
Tagged | |
software (43 posts and 3 photos) | |
mac os x (6 posts) | |
When doing the post-install setup of postgresql default database using initdb, you may hit this error: | |
FATAL: could not create shared memory segment: Cannot allocate memory | |
DETAIL: Failed system call was shmget(key=1, size=1646592, 03600). | |
You can either change the postgresql configuration to use less shared memory, or increase the system setting. | |
I suggest the latter, because this problem seems to stem from other running apps using some of the shared memory allowance, and I'd be nervous about them running out anyway if postgresql was still using a decent amount. IMHO, the default OS X limit is way too low. | |
Easy to fix; run: | |
sudo sysctl -w kern.sysv.shmall=65536 | |
sudo sysctl -w kern.sysv.shmmax=16777216 | |
(The first one's the critical one for me, but second seems appropriate too.) | |
This changes the limits in the currently-running kernel. To make these values stick across reboots, add them to /etc/sysctl.conf, like this: | |
kern.sysv.shmall=65536 | |
kern.sysv.shmmax=16777216 | |
(Create this file if it doesn't already exist – it doesn't on fresh Leopard installs.) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!