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便可設置最大進程數。

相關文章
相關標籤/搜索