When you build Erlang/OTP on OS X, it unfortunately defaults to handling a maximum of 1024 file descriptors. You can get around this limitation with the right combination of configuration options and manual changes to a generated config file.
First, go into your unpacked Erlang/OTP source directory and run the following command, replacing the value 10000 with whatever value you want for max file descriptors:
perl -i -pe 's/(define\s+FD_SETSIZE\s+)\d+/\1 10000/' erts/config.h.in
Next, when you run configure
in your Erlang/OTP source directory, be sure to include the right CFLAGS
setting, as shown below:
CFLAGS='-DREDEFINE_FD_SETSIZE -DFD_SETSIZE=15000 -D_DARWIN_UNLIMITED_SELECT' ./configure --enable-kernel-poll <other options>
For Erlang R15B01, be sure to also include the -O0
option in CFLAGS
as well.
Using _DARWIN_UNLIMITED_SELECT
forces the use of a different version of select()
that won't fail if FD_SETSIZE
is exceeded.
Finally, just use make
to build and install Erlang/OTP as usual.
You might also have to change some OS X system settings related to maximum numbers of file descriptors as explained in this StackOverflow answer.
One more: http://erlang.org/pipermail/erlang-questions/2011-October/061972.html