launchctl limit maxfiles
ulimit -a
- Reboot the system and enter recovery mode - keep cmd (⌘) + R pressed
- Disable system integrity check from terminal, by typing csrutil disable
- Reboot
- Create the files below
- Reboot
- Enable system integrity check, by typing csrutil enable
- Reboot the system to complete the changes
The last two columns are the soft and hard limits, respectively.
To adjust open files limits on a system-wide basis in Mac OS X Sierra, you must create two configuration files.
The first is a property list (aka plist) file in /Library/LaunchDaemons/limit.maxfiles.plist
that contains the following XML configuration:
sudo vi /Library/LaunchDaemons/limit.maxfiles.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.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxfiles</string>
<string>64000</string>
<string>524288</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
This will set the open files limit to 64000.
The second plist configuration file should be stored in /Library/LaunchDaemons/limit.maxproc.plist
with the following contents:
sudo vi /Library/LaunchDaemons/limit.maxproc.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>
- Change the owner for the created files
sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
sudo chown root:wheel /Library/LaunchDaemons/limit.maxproc.plist
- Load these new settings:
sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
sudo launchctl load -w /Library/LaunchDaemons/limit.maxproc.plist
- Reboot & Enable system integrity check
csrutil enable
- Finally, check that the limits are correct:
launchctl limit maxfiles
ulimit -a
Returned values should be the same
Both plist files must be owned by root:wheel and have permissions -rw-r--j--. This permissions should be in place by default, but you can ensure that they are in place by running sudo chmod 644 . While the steps explained above will cause system-wide open file limits to be correctly set upon restart, you can apply them manually by running launchctl limit.
But yes. Here's another signal from Chromium project that using the sysctl calls from the launchdaemon plists fails as of Venture 13.5 now: https://bugs.chromium.org/p/chromium/issues/detail?id=1467777
and this: https://apple.stackexchange.com/questions/462489/how-to-increase-global-max-opened-files-limit-on-osx-13-5-ventura