Created
January 3, 2011 10:35
-
-
Save j-manu/763334 to your computer and use it in GitHub Desktop.
Postgres tips
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
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.) | |
--------------- | |
installing the pg gem in snow leopard | |
sudo env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-include=/usr/local/pgsql/include --with-pg-lib=/usr/local/pgsql/lib | |
--------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment