Skip to content

Instantly share code, notes, and snippets.

@mikeatlas-r7
Forked from mikeatlas/readme.md
Created March 21, 2018 22:10
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 mikeatlas-r7/3587ed7f859a2d407315951f550bf8b7 to your computer and use it in GitHub Desktop.
Save mikeatlas-r7/3587ed7f859a2d407315951f550bf8b7 to your computer and use it in GitHub Desktop.
maxfiles ulimit on macos

Thanks to the guide located here:

https://www.macobserver.com/tips/deep-dive/evade-macos-many-open-files-error-pushing-limits/

Archived links:

First, Disable System Integrity Protection (SIP)

Once your Mac has booted into Recovery Mode, you should click Utilities from the top menu bar, then Terminal. In Terminal, issue the following command:

csrutil disable

Once you’ve logged in, you should once again open Terminal. In Terminal, type the following command:

sudo nano /Library/LaunchDaemons/limit.maxfiles.plist

Paste into that file:

<?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>

Now we can create a similar file to increase the processes limit. Still in Terminal, type this command:

sudo nano /Library/LaunchDaemons/limit.maxproc.plist

Again, you’ll be in a text editor. Copy and paste this content into the file, the same way you did previously for maxfiles.

<?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>4096</string>
 </array>
 <key>RunAtLoad</key>
 <true />
 <key>ServiceIPC</key>
 <false />
 </dict>
 </plist>

Turning SIP Back On

Finally, reboot your Mac. Back to Recovery Mode we go. You need to again restart your Mac, and hold Command-R until the Apple logo appears. When Recovery Mode has loaded, open Terminal and run this command:

csrutil enable

Reboot again into normal mode.

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