Skip to content

Instantly share code, notes, and snippets.

@tylergets
Created March 16, 2017 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylergets/90f7e61314821864951e58d57dfc9acd to your computer and use it in GitHub Desktop.
Save tylergets/90f7e61314821864951e58d57dfc9acd to your computer and use it in GitHub Desktop.
Change the open file limit on OSX Sierra.
#!/bin/bash
#Thanks to https://superuser.com/a/1171028
echo "This script increases the max files a proccess can have open in OSX Sierra."
echo "It should improve IDE performance in large projects with multiple watchers."
set -e
plistcontent=$(cat <<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>524288</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
)
#Save LaunchDaemon
echo -e "$plistcontent" | sudo tee /Library/LaunchDaemons/limit.maxfiles.plist > /dev/null
#Set permissions
sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
#Load settings
sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
@nasermirzaei89
Copy link

typo in process at line 3 😁

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