MacOS 修改最大打开文件数
时间:2023-04-27 22:18:12.76 +0800 CST 浏览:511

launchctl 管理自启动

# 创建配置文件,可根据自己情况修改65535数值
sudo vim /Library/LaunchDaemons/local.system.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>local.system.maxfiles</string>
    <key>ProgramArguments</key>
    <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string>65535</string>
      <string>65535</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>ServiceIPC</key>
    <false/>
</dict>
</plist>
# 修改权限
sudo chown root:wheel /Library/LaunchDaemons/local.system.maxfiles.plist
sudo chmod 644 /Library/LaunchDaemons/local.system.maxfiles.plist
# 加载到开机自启动
sudo launchctl load -w /Library/LaunchDaemons/local.system.maxfiles.plist


如果这篇文章对你有所帮助,可以通过下边的“打赏”功能进行小额的打赏。

本网站部分内容来源于互联网,如有侵犯版权请来信告知,我们将立即处理。


来说两句吧