OSX has a very low limit on the maximum number of open files. It causes problem now and then if you’re doing development and use load testing tools. To address the problem you can change the open file limit by doing the following:
MacOS <= 10.7 (Lion)
1 2
sudo launchctl limit maxfiles 1000000 1000000 echo"limit maxfiles 1000000 1000000" | sudo tee -a /etc/launchd.conf
Now you will have the the maxfiles limit updated after next reboot, you can use ulimit to adjust the limit for the current session:
1
ulimit -n 65335 65335
MacOS = 10.8 (Mountain Lion)
1 2 3 4
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
Now you will have the maxfiles limit updated after next reboot, you can can use ulimit to adjust the limit for the current session:
1
ulimit -n 65336 65336
MacOS >= 10.9 (Mavericks, Yosemite and E1 Capitan)
Create a file at /Library/LaunchDaemons/limit.maxfiles.plist