NodeJS error "EMFILE, too many open files" on Mac OS

Solution 1:

This worked for me:

ulimit -n 10480

found here

Solution 2:

You can solve this problem by increasing the maxfiles limit:

launchctl limit maxfiles 16384 16384 && ulimit -n 16384

Solution 3:

i had this error and the ulimit and launchclt didn't work for me,

this solution from http://yabfog.com/blog/2014/10/22/yosemite-upgrade-changes-open-file-limit worked for me

echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
sudo sysctl -w kern.maxfiles=65536
sudo sysctl -w kern.maxfilesperproc=65536
ulimit -n 65536 65536

and then putting the

ulimit -n 65536 65536

into ~/.bashrc