Skip to content

Instantly share code, notes, and snippets.

@qileq
Last active January 31, 2023 02:08
Show Gist options
  • Select an option

  • Save qileq/49fbeff99def200179001d551c0a7036 to your computer and use it in GitHub Desktop.

Select an option

Save qileq/49fbeff99def200179001d551c0a7036 to your computer and use it in GitHub Desktop.
How to Change Open Files Limit on macOS Monterey
<?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>65535</string>
<string>1048576</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>4096</string>
<string>4096</string>
</array>
<key>RunAtLoad</key>
<true />
<key>ServiceIPC</key>
<false />
</dict>
</plist>
@qileq
Copy link
Author

qileq commented Mar 29, 2022

wget https://gist.github.com/qileq/49fbeff99def200179001d551c0a7036#file-limit-maxfiles-plist
wget https://gist.github.com/qileq/49fbeff99def200179001d551c0a7036#file-limit-maxproc-plist

sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
sudo chown root:wheel /Library/LaunchDaemons/limit.maxproc.plist

sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
sudo launchctl load -w /Library/LaunchDaemons/limit.maxproc.plist

launchctl limit

In some cases you maybe need to restart the machine for above to take effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment