Mac提示Could not set resource limits: 150: Operation not permitted while System Integrity Protecti解决方案

一、前言

运行环境:
在这里插入图片描述

在应用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/668

It 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芯片
  1. 重启电脑并常按command+R,直到看到APPLE图标
  2. 从菜单栏转到Utilities > Terminal
  3. 终端输入 csrutil disable,并按回车键即可禁用SIP。
  4. 终端输入reboot,正常重启计算机。
  • m 芯片
    M系列芯片的Mac pro使用原来的command + R死活进不去恢复模式。原来M2芯片的步骤已简化为:
  1. 关机,不是重新启动。
  2. 长按开机键不松开,当屏幕出现⚙️齿轮是松开,点击齿轮,选择”继续“,就可以进去了。左上角实用工具-终端。
  3. 终端输入csrutil disable,并按回车键即可禁用SIP。
  4. 终端输入reboot,正常重启计算机。

重启后可终端输入csrutil status,查看开启还是关闭状态,即判断是否设置成功。

四、拓展阅读

当出现"Could not set environment: 150: Operation not permitted while System Integrity Protection is engaged"的错误提示时,这意味着系统完整性保护(SIP)正在运行,而您的操作需要关闭SIP。为了解决这个问题,您可以按照以下步骤进行操作: 1. 从Apple菜单中,选择"重新启动",然后选择"重新启动"。 2. 在重启时按住"Command"和"R"按钮,这将启动您的计算机进入恢复模式。 3. 在恢复模式下,从菜单栏选择"实用工具",然后选择"终端"。 4. 在终端中,输入命令"csrutil disable",然后按下"Enter"键。这将禁用系统完整性保护。 5. 重新启动您的计算机,完成后您将能够执行需要关闭SIP的操作。 请注意,关闭SIP可能会降低您的计算机的安全性,因此在完成您的操作后,建议重新启用SIP,可以通过在恢复模式下执行"csrutil enable"命令来实现。这将重新启用系统完整性保护,提高您的计算机的安全性。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Mac 域名解析不了,能ping通ip,但ping不通网址](https://blog.csdn.net/zjcxhswill/article/details/116176743)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [mac环境配置错误,导致命令行工具失效,亲测有效。](https://blog.csdn.net/weixin_42689212/article/details/121528885)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted](https://download.csdn.net/download/weixin_38515573/12901632)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

No Silver Bullet

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值