Download this gist, and then run:
chmod 755 open_files_limit_mac.sh
./open_files_limit_mac.sh
Restart the system, and then run:
ulimit -n 65536
| limit maxfiles 65536 65536 |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Label</key> | |
| <string>limit.maxfiles</string> | |
| <key>ProgramArguments</key> | |
| <array> | |
| <string>launchctl</string> | |
| <string>limit</string> | |
| <string>maxfiles</string> | |
| <string>65536</string> | |
| <string>65536</string> | |
| </array> | |
| <key>RunAtLoad</key> | |
| <true/> | |
| <key>ServiceIPC</key> | |
| <false/> | |
| </dict> | |
| </plist> |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Label</key> | |
| <string>limit.maxproc</string> | |
| <key>ProgramArguments</key> | |
| <array> | |
| <string>launchctl</string> | |
| <string>limit</string> | |
| <string>maxproc</string> | |
| <string>2048</string> | |
| <string>2048</string> | |
| </array> | |
| <key>RunAtLoad</key> | |
| <true /> | |
| <key>ServiceIPC</key> | |
| <false /> | |
| </dict> | |
| </plist> |
| #!/bin/bash | |
| echo "Current Limits" | |
| launchctl limit | |
| sudo cp limit.maxfiles.plist /Library/LaunchDaemons/limit.maxfiles.plist | |
| sudo cp limit.maxproc.plist /Library/LaunchDaemons/limit.maxproc.plist | |
| sudo cp launchd.conf /etc/launchd.conf | |
| sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist | |
| sudo chown root:wheel /Library/LaunchDaemons/limit.maxproc.plist | |
| sudo chown root:wheel /etc/launchd.conf | |
| sudo chmod 644 /Library/LaunchDaemons/limit.maxfiles.plist | |
| sudo chmod 644 /Library/LaunchDaemons/limit.maxproc.plist | |
| sudo chmod 644 /etc/launchd.conf | |
| launchctl limit | |
| echo "Please restart for the changes to take effect, and then run:" | |
| echo "ulimit -n 65536" |