File “corrupted and cannot be opened” when opening a double-attached file

I have an installed directory to access some images. When you first open an image with, open /mounted_dir/foo.jpgit opens the image in preview mode. When repeating the same command, it gives an error: /mounted_dir/foo.jpg is damaged and can't be opened. You should move it to the Trash.

I saw this error message on the Internet, but only for applications and not for image files. In addition, this file is not corrupted, for example:

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

Is there any other way than setting a preference for this (in the "System Preferences"> "Security and Privacy" section: set "Allow applications downloaded from" to "Anywhere")?

Ideally, I would like open -force or command line mode to tell the system that the file is not corrupted, or (in extreme cases) the command line to set System Preferences> Security and Privacy.

+4
source share
1 answer

Check if the com.apple.quarantine flag is set, and if so, uninstall it.

xattr foo.pdf
com.apple.quarantinexattr -d com.apple.quarantine foo.pdfxattr foo.pdf

Alternatively, disable Gatekeeper. Take a look here: https://boxcryptor.desk.com/customer/portal/articles/688364-why-am-i-receiving-the-error-%22filexyz-is-damaged-and-can-t-be-opened- you-should-move-it-to-the-trash-% 22-under-mountain-lion-

+4
source

Source: https://habr.com/ru/post/1529922/


All Articles