美文网首页
macos 修改最大文件数限制

macos 修改最大文件数限制

作者: CrystalZhu | 来源:发表于2020-01-10 15:44 被阅读0次
    1. sudo su - root
      2.vim /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>200000</string>
              <string>200000</string>
            </array>
          <key>RunAtLoad</key>
            <true/>
          <key>ServiceIPC</key>
            <false/>
        </dict>
      </plist>
    
    1. vim /Library/LaunchDaemons/limit.maxproc.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.maxproc</string>
          <key>ProgramArguments</key>
            <array>
              <string>launchctl</string>
              <string>limit</string>
              <string>maxproc</string>
              <string>2048</string>
              <string>2048</string>
            </array>
          <key>RunAtLoad</key>
            <true />
          <key>ServiceIPC</key>
            <false />
        </dict>
      </plist>
    
    1. 为文件设置权限
      sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist
      sudo chown root:wheel /Library/LaunchDaemons/limit.maxproc.plist

    5.如果你不关机的话可以调用以下操作 load 设置的属性
    sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
    sudo launchctl load -w /Library/LaunchDaemons/limit.maxproc.plist

    1. 检查是否生效
      sudo launchctl limit
        cpu         unlimited      unlimited      
        filesize    unlimited      unlimited      
        data        unlimited      unlimited      
        stack       8388608        67104768       
        core        0              unlimited      
        rss         unlimited      unlimited      
        memlock     unlimited      unlimited      
        maxproc     2048           2048           
        maxfiles    524288         524288      
    

    相关文章

      网友评论

          本文标题:macos 修改最大文件数限制

          本文链接:https://www.haomeiwen.com/subject/qrxmactx.html