Apple System: Error: ENFILE: file table overflow

在MAC上跑nodejs,遇到了一个问题:

Paste_Image.png

主要大概是说文件打开太多了,超过了限制。

产生这个问题主要是苹果操作系统的限制,具体参考这个ISSUE

I'm glad this is solving it for everyone. Unfortunately, Apple sets ridiculously low limits by default which might be good for some users, but is awful for developers.
For what it's worth, I would recommend setting the limit much much higher than 65536 (524288 is great).
Additionally, I would recommend using a method that doesn't modify /etc/ files directly since throughout the years Apple has randomly decided to stop loading these files (for example, it used to be a common recommendation to put this in /etc/launchd.conf, but that no longer works in Yosemite).

具体的设置如下:

echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
sudo sysctl -w kern.maxfiles=65536
sudo sysctl -w kern.maxfilesperproc=65536
ulimit -n 65536
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 13,496评论 0 23
  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 14,599评论 5 6
  • 晚风拂面, 将话语带到我的耳边, 灯光昏暗, 我喜欢这若隐若现。 鸡尾酒的气泡升腾着, 在这晚风中, 谁弹奏了一曲...
    phantomses阅读 2,701评论 0 4
  • 曾经有段时间喜欢瑜伽,甚至有些走火入魔。那时候买了张会员卡,几乎每星期都会去练几次,每㳄练完人都觉得非常轻松。 原...
    RainbowPeng阅读 5,090评论 14 46
  • 去看一位朋友,路不远,索性步行。回家的时候,淅淅沥沥地下起了雨。秋雨,不大,却很冷。夹着风打过来,透骨的寒意。 路...
    五经博士阅读 4,278评论 0 3

友情链接更多精彩内容