Xcode 调试时报错 attach failed (not allowed to attach to process)

Xcode 调试时报错 attach failed (not allowed to attach to process)

现象

error: attach by pid '2707' failed -- attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.)

解决方案

无效: 重启 Xcode,重启 simulator

无效:clean build

无效: 重启电脑

解决: 更新证书并且关闭 SIP

此前开发者证书已经过期,于是改为 personal 开发,

关闭 SIP 应该是比较核心的操作,

  • 白苹果进入 recovery 系统中,在终端中输入
csrutil disable

重启即可生效,进入macos 系统后,在终端中查看 sip 状态可以使用

csrutil status
  • 如果是在黑苹果中,可以在 nvram 中的 csr-active-config中进行设置,对于 15.x 的 MacOS Sequoia ,其代码为 ff0f0000

发表回复