Mac OS Operation not permitted 解决方案

最近把系统升级为 Monterey 最新版本,怀疑和系统升级有关系。

unable to execute xxx.sh : Operation not permitted

分析:

苹果系统有一个GateKeeper保护机制(自 OSX 10.5 加入)。从互联网上下载来的文件,会被自动打上 com.apple.quarantine 标志,翻译过来就是免疫隔离,系统根据这个附加属性对这个文件作出限制。

解决:

sudo xattr -r -d com.apple.quarantine +目录路径

Mac error.png

执行 ./test.sh 发现可以正常执行.

附上破解实例:

cd ~/Downloads/parallelsdesktopcrack

sudo xattr -r -d com.apple.quarantine ~/Downloads/parallelsdesktopcrack

chmod +x ./install.sh

sudo ./install.sh