Apple has a limit on the maximum number of open files on macOS which by default is 10240.
To exceed this limits system wide settings can be configured e.g.
To make the limit persistent the values must be stored in /Library/LaunchDaemons/limit.maxfiles.plist
and loaded via launchctl. (Please note this XML may vary between Mac OS versions - the below example is for Big Sur)
sudo launchctl load -w /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>sudo</string> <string>launchctl</string> <string>limit</string> <string>maxfiles</string> <string>655360</string> <string>1048576</string> </array> <key>RunAtLoad</key> <true /> </dict> </plist>