1. the “Too many open files” error of MacOSX

  1. the “Too many open files” error of MacOSX
# maxfiles is 256 too small.

wander$ launchctl limit
  cpu         unlimited      unlimited
  filesize    unlimited      unlimited
  data        unlimited      unlimited
  stack       8388608        67104768
  core        0              unlimited
  rss         unlimited      unlimited
  memlock     unlimited      unlimited
  maxproc     2784           4176
  maxfiles    256           10240

# change maxfiles to 4096.

wander$ sudo launchctl limit maxfiles 4096 unlimited
wander$ launchctl limit
  cpu         unlimited      unlimited
  filesize    unlimited      unlimited
  data        unlimited      unlimited
  stack       8388608        67104768
  core        0              unlimited
  rss         unlimited      unlimited
  memlock     unlimited      unlimited
  maxproc     2784           4176
  maxfiles    4096           10240

remind:

Some terminal modifications cannot take effect immediately and need to be restarted, such as iterm2.