How can I “Open an app from an unidentified developer” without using the GUI?
-
16-04-2021 - |
Question
Basically, I used the native Safari.app
web browser to download a third party application and I want to run / open
it from the comfort of my bash
shell / Terminal.app
CLI; despite the following error message:
“<unidentified_thirdparty.app>” can’t be opened because it is from an unidentified
developer. Your security preferences allow installation of only apps from the Mac
App Store and identified developers. Safari downloaded this file on <today's_date>
from <the.inter.net>.
|[OK]|
Solution
You'll either have to change the settings under System Preferences > Security & Privacy > General > Allow applications downloaded from: to Anywhere or in a Terminal, strip the xattr
com.apple.quarantine attribute from the downloaded file(s).
xattr -dr com.apple.quarantine "unidentified_thirdparty.app"
OTHER TIPS
Enter this in the Terminal under a administrator account: sudo spctl --master-disable
To do it wisely in command line
xattr -p com.apple.quarantine unidentified_thirdparty.app
outputs something like0081;5e7fec61;Chrome;6585C1D3-E260-4275-9E6E-505DF8D6B7EE
- Copy the output string, replace first 4 characters with
00c1
- run
xattr -w com.apple.quarantine 00c1;5e7fec61;Chrome;6585C1D3-E260-4275-9E6E-505DF8D6B7EE unidentified_thirdparty.app
or, combine these steps into a single command:
xattr -w com.apple.quarantine "$(attr -p com.apple.quarantine unidentified_thirdparty.app | sed 's/^.\{4\}/00c1/' )" unidentified_thirdparty.app
My blog post on this.
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange