tim*_*our 4 macos file osx-gatekeeper
I have a mounted directory to access some images.
When opening an image for the first time with open /mounted_dir/foo.jpg it opens the image in preview.
When repeating the same command it gives the error:
/mounted_dir/foo.jpg is damaged and can't be opened. You should move it to the Trash.
I have seen this error message on the web but only for apps, not image files. Furthermore, the file in question doesn't appear damaged, eg:
cp /mounted_dir/foo.jpg /tmp/foo.jpg
diff /mounted_dir/foo.jpg /tmp/foo.jpg #no difference
open /tmp/foo.jpg #works
open /mounted_dir/foo.jpg #same error
Run Code Online (Sandbox Code Playgroud)
Is there any other way than setting preference to do this (in System Preferences > Security & Privacy: Set "Allow Applications Downloaded From" to 'Anywhere') ?
Ideally, I'd like either a open --force mode or a command line way to tell the system that the file isn't damaged, or (last resort) command line to set the System Preferences > Security & Privacy option.
检查 com.apple.quarantine 标志是否已设置,如果已设置,请将其删除。
? xattr foo.pdf
com.apple.quarantine
? xattr -d com.apple.quarantine foo.pdf
? xattr foo.pdf
Run Code Online (Sandbox Code Playgroud)
或者,禁用网关守卫。请参阅此处:https : //boxcryptor.desk.com/customer/portal/articles/688364-why-am-i-receiving-the-error-%22filexyz-is-damaged-and-can-t-be-opened-你应该把它移到垃圾箱-%22-under-mountain-lion-
| 归档时间: |
|
| 查看次数: |
3265 次 |
| 最近记录: |