"XYZ"is damaged and can't be opened [FIX]
I'm actually here to offer a solution to this problem, since any other post I've found gives good insight that unfortunately didn't cut it for me.
I've spent a whole day trying to fix this, and even reinstalling Catalina from Recovery was not able to solve it.
I hope that if you're reading this and are stuck with my same issue, that it will fix it and save you precious hours.
Symptoms
Any file you download, no matter what browser you use, even iCloud files, will throw a "XYZ.[jpg/zip/rar/dmg/...]" is damaged and can't be opened" error. You can still open the file from within an app, but not from the Finder. Please note that this applies to any FILES, not just apps, for which usually the circulating solutions work.
Cause
As far as I could investigate, the issue (as stated on other threads) is a corrupt GateKeeper database file or resource. Any solution I found didn't work for me (i.e. disabling GK via sudo spctl --master-disable or defaults write com.apple.LaunchServices LSQuarantine -bool NO).
Some other solutions pointed me to a broken /var/db/gkopaque.bundle to be replaced from a working install. I have my laptop running a clone of the affected Mac Pro drive, but it didn't prove useful.
Ok, to cut things short, if you're here you've probably already seen those answers and tried for yourself, so here what has worked for me and I had a VERY hard time finding this.
Solution
It's actually super easy: I've found this nice utility called SilentKnight that performs sanity and security checks on Mac platforms, from firmware version to... GateKeeper health status!
You can download it from here: https://eclecticlight.co/lockrattler-systhist/
[Disclaimer: I am not affiliated in any way to the website or the programmer, and usage of the software is at your own risk]
If you have issues opening the ZIP file and the app (as if you didn't, you probably wouldn't be reading this at all...), use this temporary workaround for authorising the execution of a single file:
- Open Terminal
- Type sudo xattr -d com.apple.quarantine /path/to/file.[zip/app/...]
- This will validate the file and GateKeeper will be happy
I ran SilentKnight and it found issues with the GateKeeper databases. It downloaded on its own the latest versions for my OS (which were not showing up as my Catalina is already the latest version) and... that was it!
I did press the "Install all updates" but I'm pretty sure it fixed GK before that. Maybe try closing it first and reopening to see if a green check has appeared next to GateKeeper.
That's it, I really hope you'll find these info useful!
Mac Pro, macOS 10.15