Skip to content

Instantly share code, notes, and snippets.

@drydevelopment
Last active January 17, 2019 19:21
Show Gist options
  • Save drydevelopment/0d2052adb91a692933d7a4406e35cc8d to your computer and use it in GitHub Desktop.
Save drydevelopment/0d2052adb91a692933d7a4406e35cc8d to your computer and use it in GitHub Desktop.
Too many open files - macOS Workaround

Too many open files - macOS Workaround

  1. Creating a launchd Property List File

    Create a launchd property list file, and paste the followin snippet at /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>64000</string>
          <string>524288</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>ServiceIPC</key>
        <false/>
      </dict>
    </plist> 
    
  2. Change the Ownership of the launchd Property List File

    $ sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
    
  3. Load the launchd Property List File

    $ sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
    
  4. Validate launchd Property List File is Loaded

    $ launchctl limit maxfiles
    	maxfiles    64000          524288
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment