已损坏,无法打开。您应该将它移到废纸篓

安装破解版的app或者非appstroe的app经常会遇到这个问题。出现这个情况,通过下面的方法并不能解决:

  1. 系统偏好设置-任何来源“——不管用
  2. 没有任何来源字样,搞定之后勾上任何来源,不管用

实际上问题是出在了mac的quarantine flag上,如果要修复这个问题需要用到下面的命令:

sudo xattr -rd com.apple.quarantine /Applications/xxx.app

com.apple.quarantine属性:

Type: com.apple.quarantine
Subtypes: none
Serialisation: none
Data type: UTF-8 string containing Gatekeeper score, the system time of download, the downloading app or agent, and a UUID for the event
Example: <30303833 3b353833 37316533 633b5361 66617269 2e617070 3b334239 32393643 302d4336 46342d34 3942332d 42414331 2d424342 32323946 46453744 36> «0083;58371e3c;Safari.app;3B9296C0-C6F4-49B3-BAC1-BCB229FFE7D6»
macOS: El Capitan, Sierra, High Sierra
System use: very uncommon
App use: all downloaded apps
Document use: common, notably Zip and other archives which have been downloaded
Other usage: none

Purpose: flags requirement to perform full Gatekeeper check on downloaded app (or executable).

发生这个情况的原因如下:

The UUID corresponds to an entry in the QuarantineEvents database (SQLite) at ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2. As of Sierra, no checking is performed on the app named as the downloading agent, and the UUID may not be checked either.

Sticky, and inherited by files within archives, etc. When unzipped, a single bit may be set in the high-order byte of the Gatekeeper score. In binary, that might be
00000001 10000011

When that app is run, Gatekeeper performs a full check on it; assuming that it passes and is authorised for use on that Mac and is then run, the Gatekeeper score would become
00000001 11100011
with two bits set: the higher-order bit indicates that it has passed the full Gatekeeper check, and the other that the app has now been run as well.

Tools: xattred, xattr

It is possible to add a quarantine flag in Terminal.

First obtain a UUID using the Terminal command
/usr/bin/uuidgen
which should be suitable for pasting at the end of the xattr string, with a command like
/usr/bin/xattr -w com.apple.quarantine "0083;5991b778;Safari.app;BC4DFC58-0D26-460D-9688-81D119298642" appname.app

If that doesn’t trigger a full check, then try inserting the UUID into the QuarantineEvents database using a command of the form
/usr/bin/sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 "INSERT INTO \"LSQuarantineEvent\" VALUES('BC4DFC58-0D26-460D-9688-81D119298642',5991b778,NULL,'Safari.app','http://dummy.com/file.zip',NULL,NULL,0,NULL,'/Users/nyname/appname.app',NULL);"

Check that record for the UUID using the command
/usr/bin/sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 "SELECT * FROM LSQuarantineEvent WHERE LSQuarantineEventIdentifier == 'BC4DFC58-0D26-460D-9688-81D119298642'"

Then repeat the command to add the quarantine xattr, as above.

Links:
klanomath on StackExchange’s AskDifferent
reitermarkus and others on GitHub’s caskroom/homebrew-cask

原文链接:https://eclecticlight.co/2017/12/11/xattr-com-apple-quarantine-the-quarantine-flag/

☆版权☆

* 网站名称:obaby@mars
* 网址:https://lang.ma/
* 个性:https://oba.by/
* 本文标题: 《已损坏,无法打开。您应该将它移到废纸篓》
* 本文链接:https://lang.ma/2020/02/6955
* 短链接:https://oba.by/?p=6955
* 转载文章请标明文章来源,原文标题以及原文链接。请遵从 《署名-非商业性使用-相同方式共享 2.5 中国大陆 (CC BY-NC-SA 2.5 CN) 》许可协议。


You may also like

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注