12 September 2012
after brew install postgresql

then run "initdb /usr/local/var/postgres -E utf8", may got:

selecting default shared_buffers ... 400kB
creating configuration files ... ok
creating template1 database in /usr/local/var/postgres/base/1 ... FATAL:  could not create shared memory segment: Cannot allocate memory
DETAIL:  Failed system call was shmget(key=1, size=2138112, 03600).
HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space, or exceeded your kernel's SHMALL parameter.  You can either reduce the request size or reconfigure the kernel with larger SHMALL.  To reduce the request size (currently 2138112 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
The PostgreSQL documentation contains more information about shared memory configuration.
child process exited with exit code 1
initdb: removing data directory "/usr/local/var/postgres"

fixes as:

 ~  sudo sysctl -w kern.sysv.shmall=1024000
kern.sysv.shmall: 8192 -> 1024000
 ~  initdb /usr/local/var/postgres -E utf8 

then everything will move smoothly.

just for note.

blog comments powered by Disqus