How to bypass Gatekeeper with ease
So in macOS they added the 'scare prompt' a while ago (OS X 10.5!!), where if you download a file from your web browser (specifically!) it will be flagged as quarantined. If you try open a 'scary' file like an executable that has the quarantine flag, you will be presented with the following prompt:
If you're reading this, you're probably technically minded. And you know that you do in fact want to run this file. Most of the time I encounter this is when I download an open source application, and the developer hasn't signed it. Signing costs $99/year, and allows you to notarize your releases with Apple. This is not exclusive to macOS. Windows has a similar scare screen that will go away if you pay them money. Anyway.
Simplest Way: Manually Clear the Quarantine Flag
xattr -dr com.apple.quarantine ../example.app
Breaking this down:
xattris the macOS tool for managing extended attributes. Legitimate uses for these things are tags in Finder.-dfor delete.-rfor recursive. Potentially good for a.appthat contains other executables. (Remember.apps are just folders in disguise!)com.apple.quarantineis the flag in reverse domain name notation.
Slightly Nicer Way: Quick Action
A way to make this a bit nicer is to put it in a quick action via Shortcuts. Any time you download an application, you can use the quick action in Finder to scrub the quarantine flag. The Shortcut is pretty simple, but you can download it here to save some time if you want. Just make sure to set it as a quick action in the configuration.
The Horrible Annoying Way (For Posterity)
The offical Apple sanctioned way to do this is to open the program, then go to System Settings, go to the "Privacy & Security" section and you'll see the "Open Anyway" button.
After this, it has the gall to show you another damn prompt. You have to click "Open Anyway" again.
This way sucks but is useful if you want to instruct a non-technical user on this process.
Can I Just Disable This Completely??
Umm, I wouldn't recommend it. But I might as well include it here.
$ sudo spctl --global-disable
Password: π
Globally disabling the assessment system needs to be confirmed in System Settings.
Then you have to go to System Settings, the "Privacy & Security" section, then you can enable the "Anywhere" option:
If you decide to come back to the good side, you can re-enable it with sudo spctl --global-enable.
Further reading
I enjoy putting these at the end of my posts, cos I have to do research for most of them, and it ends up in me having a lot of browser tabs that I can then dump in here. I hope that if my post interests you, maybe other people's posts will too!
Annoyingly in this subject there is not too much high quality blog content about this, and a lot of sub-par information that will tell you to do things the annoying way.
- Explainer: Quarantine by The Eclectic Light Company. For more in depth explaining, there is a further post Quarantine and the quarantine flag.