This problem has been reported many times by FreeBSD users, but it appears to happen on also on Mac OS X. When they started MPD they got the following error :
The shmget function must not be called from within jails. But there's a MIB entry which determines whether processes have access to those System V IPC primitives. You can change this behaviour by typing
You can add this to your /etc/sysctl.conf to set this value every startup. But be aware that this currently affects all jails on a system.
If you are not running any jails, the problem may simply be a limit on the amount of shared memory that can be allocated. To increase the amount of shared memory available, adjust the kern.ipc.shmall and kern.ipc.shmmax sysctl variables. Doubling both of them is usually a good start.
Under NetBSD mpd can use up more pages than allowed. Try
sysctl -w kern.ipc.shmmaxpgs=4096
Mac OS X Edit
It seems that defaults settings for shared memory are too restrictive, making applications to prevent others to get some shared memory. Check application that use shared memory, especially non apple ones with
lsof | grep PSXSHM
For example, stopping postgresql enabled mpd to start correctly on at least one system. Also, mpd cannot startup more than one time, the second time it raises the "Problems shmget'ing" error and exits. You can increase shared memory to avoid errors if you edit /etc/rc and change
sysctl -w kern.sysv.shmmax=4194304 kern.sysv.shmmin=1 kern.sysv.shmmni=32 kern.sysv.shmseg=8 kern.sysv.shmall=1024
sysctl -w kern.sysv.shmmax=8388608 kern.sysv.shmmin=1 kern.sysv.shmmni=32 kern.sysv.shmseg=8 kern.sysv.shmall=2048