Skip to content

Instantly share code, notes, and snippets.

@supercoffee
Created December 28, 2017 20:17
Show Gist options
  • Save supercoffee/773c62a663cb3ad2ba4f2e28acaafa57 to your computer and use it in GitHub Desktop.
Save supercoffee/773c62a663cb3ad2ba4f2e28acaafa57 to your computer and use it in GitHub Desktop.
Increase open file limit on MacOS
#!/usr/bin/env bash
cat > /tmp/limit.maxfiles.plist << EOF
<?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>128000</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
EOF
sudo cp /tmp/limit.maxfiles.plist /Library/LaunchDaemons
sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
@supercoffee
Copy link
Author

supercoffee commented Dec 28, 2017

Source
Works on MacOS Sierra, other versions untested.

Persists settings across reboots.

#Usage

  1. Download raw file
  2. Make executable using chmod +x file-limit-hax.sh
  3. ./file-limit-hax.sh

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