-
-
Save jimschubert/8e7b917924244bbc0d029511c7f9c385 to your computer and use it in GitHub Desktop.
Enables setting Mac OS 10.10 Yosemite open file limit to 65535 & max procs to 2048
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
cat <<MAXFILES > /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>65536</string> | |
<string>65536</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>ServiceIPC</key> | |
<false/> | |
</dict> | |
</plist> | |
MAXFILES | |
cat <<MAXPROC > /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> | |
MAXPROC | |
chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist | |
chmod 644 /Library/LaunchDaemons/limit.maxfiles.plist | |
chown root:wheel /Library/LaunchDaemons/limit.maxproc.plist | |
chmod 644 /Library/LaunchDaemons/limit.maxproc.plist | |
launchctl limit > /dev/null | |
echo "This script created the following files: | |
/Library/LaunchDaemons/limit.maxfiles.plist | |
/Library/LaunchDaemons/limit.maxproc.plist | |
" | |
echo "Please restart for limits to take effect | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment