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=16777216This 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
Comments
Thanks a lot for this hint. I found a lot of recommendations to increase shmmax, but as you mentioned, shmall is the key.
Muchas gracias, llevaba ya varias horas sin lograr nada.
Tu explicación fue clara y concisa.
-----
Thank you very much, i spent several hours without achieving anything.
Your explanation was clear and concise.
Gracias.
México
De nada :).
Dude, ...thx!
Thanks for this, I had this set properly upon install, but the latest security update for Snow Leopard reset shmall...
Awesome, thanks!
Also fixes the issue on Snow Leopard, by the way. Thanks a lot!
Fixed PG 8.4.4.1 on OS 10.6.5
Thanks!
To get this to work on my 2007 MacBook Pro,
I had to use:
kern.sysv.shmmax=67108864
(That is 16777216*4)
My Postgres was requesting 36872192.
Fixed PostgreSQL 9.0.4 on OS X 10.7.
Thanks a lot.
Thank you :)
This fixed it for me, and I added the fix to a Homebrew issue: https://github.com/mxcl/homebrew/issues/3162
They ended up pointing people here. http://www.postgresql.org/docs/current/static/kernel-resources.html#SYSVIPC
It has instructions on doing the same thing, but there's a lot more reading to do. Your concise explanation and instructions are much appreciated!
thank you. this worked!
thank you. this worked!
Thanks for this! Simply running `sudo sysctl -w kern.sysv.shmall=65536` solved the issue for me (I'm running Mac OS X Lion 10.7.4).
Thanks, worked like a charm!
Thank you! Thank you! Thank you! Solved my problem in a single command. You rock!!!!! :D
Thanks.. fixed the issue. :)
Thanks! It worked perfectly!
Works for me, thanks!
Many thanks Will, much appreciated.
This fixed 9.1 running on Snow Leopard, after a few pitfalls upgrading from 8.4. I am guessing 9.1 demands a greater amount of shared memory compared to the older version.
http://www.shpltd.co.uk/abercrombieuk.htmlAbercrombie Fitch Garments Come In A Range Of Colors and Designs
http://www.skillclear.co.uk/aboutok.aspoakley sunglasses sale
Beginner article presents you with the important information on the sunglasses and as a consequence reasons why you should take action straight away.