mac上解决Resource temporarily unavailable

Resource temporarily unavailable这种问题通常是由于当前的进程数或者文件数不够app

fork: Resource temporarily unavailablexml

修改最大进程数blog

咱们能够经过ulimit -a来查看当前系统的一些系统参数。进程

 

在上面这些参数中,一般咱们关注得比较多的是一个进程可打开的最大文件数,即open files
系统容许建立的最大进程数量便是max user processes 这个参数。

string

maxproc表示的是开启的最大进程数,第一个1064表示的是soft限制,第二个1064表示的是hard限制,即硬件最大的限制数,本身设置的不能高于hard限制。因此 我soft也改为了1064最大的。it

maxfiles表示的是开启的最大文件数(句柄),意义同上……io

修改的方式以下coding

打开或者新建一个文件:/Library/LaunchDaemons/limit.maxfiles.plistList

输入:file

<?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>65536</string>

          <string>65536</string>

        </array>

      <key>RunAtLoad</key>

        <true/>

      <key>ServiceIPC</key>

        <false/>

    </dict>

  </plist>

保存并重启mac便可设置最大文件数。

打开或者新建一个文件:/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>

保存并重启mac便可设置最大进程数。

相关文章
相关标签/搜索