问题:Mac 软件重签名报错:illegal hardware instruction

问题:如标题所述。
签名使用命令:
codesign -f -s “Mac Developer: xxxx (xxxxx)” --entitlements /Users/xxx/Desktop/entitlements.plist xx(程序的可执行文件)
问题复现过程:
如果用上述命令重签名没有沙盒的软件的话是没有问题的。但是如果被重签名的软件包含沙盒也就是entitlements.plist内包含:
com.apple.security.app-sandbox

则在/Applications/QQ.app/Contents/MacOS/xxx 时会出现:
illegal hardware instruction
请问有遇到过这个问题并解决的吗?
之所以想保留:
com.apple.security.app-sandbox

在entitlements.plist内是因为如果不保留的话,软件运行时会将资源文件写入~/Documents。觉得这样不合适。

今天也遇到了这个问题,在 entitlements.plist 里增加下

com.apple.security.inherit 就行了,不能包含别的配置,否则还是会报这个错!亲测有效;

原本不想回复了,想想还是回复吧,或许可以帮助后来的小伙伴们(* ̄︶ ̄)

Stack Overflow上也有个这样的问题:objective c - Embedding a Java runtime into a sandboxed Cocoa Mac app - Stack Overflow