一、前言
运行环境:
在应用Jenkins构建ios项目阶段,终端反复出现Error: EMFILE: too many open files
错误,
This error is because of a bug in module fsevents for mac m1 silicon.
See the thread: https://github.com/facebook/metro/issues/668It got fixed with new version of watchman. Upgrade your watchman
through brew. Delete your project and download from git and rebuild
everything along with pod install and then it should archive no
problem.
Facebook guy admitting to the bug and fixing it
此错误是由于mac m1芯片的模块fsevents
中的错误造成的。请参阅线程:https://github.com/facebook/metro/issues/668
它得到了修复与新版本的watchman。升级您的watchman通过brew。删除您的项目,并从git下载,并重建一切沿着pod安装,然后它应该归档没有问题。
二、维护文件上限
经排查是因为项目较大,发布过程中已经超过了mac默认的文件监听上限。
给出的解决方案是执行sudo launchctl limit maxfiles 524288 524288
命令重置文件最大上限。
在执行以上命令时,控制台给出如下错误提示,
Could not set resource limits: 150: Operation not permitted while System Integrity Protection is engaged
原因是系统集成保护 (SIP) 的 macOS 安全功能会影响磁盘权限和操作,需要访问 macOS 恢复窗口以输入一组命令并禁用 SIP。
三、如何关闭SIP?
- Intel芯片
- 重启电脑并常按
command+R
,直到看到APPLE图标 - 从菜单栏转到
Utilities > Terminal
。 - 终端输入
csrutil disable
,并按回车键即可禁用SIP。 - 终端输入
reboot
,正常重启计算机。
- m 芯片
M系列芯片的Mac pro使用原来的command + R
死活进不去恢复模式。原来M2芯片的步骤已简化为:
- 关机,不是重新启动。
- 长按开机键不松开,当屏幕出现⚙️齿轮是松开,点击齿轮,选择”继续“,就可以进去了。左上角实用工具-终端。
- 终端输入
csrutil disable
,并按回车键即可禁用SIP。 - 终端输入
reboot
,正常重启计算机。
重启后可终端输入csrutil status
,查看开启还是关闭状态,即判断是否设置成功。