Solution: UE Warning Open files limit too small (macOS modifies the maximum number of files that can be opened by the process)

Environment: Unreal 4.27.2 source code version + Rider 2023.1 + MacbookPro 2023(M2 Max) + macOS Ventura 13.3.1(a).

Because UE has been warning “LogInit: Warning: Open files limit too small: 2048, should be at least OPEN_MAX (10240). rlim_max is 65535, kern.maxfilesperproc is 2048. UE4 may be unstable.” during runtime, I made the modifications in this article.

The solution steps are as follows:

  • Verify the situation sysctl -a | grep maxfiles
    • For example (the numbers in the example are written randomly):
    • kern.maxfiles: 12288 indicates that the system’s maximum number of open files is limited to 12288. Also known as “hard limit”
    • kern.maxfilesperproc: 10240 indicates that the maximum number of open files for a single process is limited to 10240. Also known as “soft limit”
    • In addition: The ulimit -n command displays the maximum number of files that the current shell can open. This value is always less than the value of kern.maxfilesperproc, because a shell is a process.
  • Run command sudo vim /Library/LaunchDaemons/limit.maxfiles.plist and write the following content
    <?xml version="1.0" encoding="UTF-8"?>  
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"  
    <plist version="1.0">  
  • Execute permission modification sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
  • Add startup tasks sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
  • Restart your computer
  • Verification
    • Core parameter verification: sysctl -a | grep maxfiles If the output parameters are 64000 and 524288, it means success.
    • Daemon verification: sudo launchctl list | grep limit.maxfiles If the daemon runs successfully, it will display output similar to the following:- 0 limit.maxfiles

In addition: After installing aTrust on the actual machine, it was found that the above verification failed, and the solution was:

  • Found com.sangfor.limit.maxfiles when launchctl list
  • You can use this command to view the configuration content of the daemon:sudo launchctl list com.sangfor.limit.maxfiles
  • You can see the specific content of the relevant task using this command:cat /Library/LaunchDaemons/com.sangfor.limit.maxfiles.plist
  • Use this command to close this redundant task:sudo launchctl unload -w /Library/LaunchDaemons/com.sangfor.limit.maxfiles.plist

Related info:

Chinese version: