Sometimes when you download and app for your Mac from the internet you unpack it and maybe get a disk image (DMG) and inside it there’s the app that you drag & drop into your Applications folder. But when you doubleclick the app it doesn’t launch. Instead you might see this kind of dialog:
But wait! Don’t delete the app just yet! There are a couple of things you can try before you give up eventually.
Out-of-the-box a modern macOS (like Catalina, Mojave or even earlier versions) doesn’t allow apps from unknown developers. But if you really want to use such an app you can still switch off macOS’s Gatekeeper. You just need to quit System Preferences (if it’s running), open a Terminal window (you know how, right?) and enter this command:
sudo spctl --master-disable
Then open System Preferences (again) and select the Security & Privacy pane and there the General tab. Notice that in the lower half there’s a new, third option under the „Allow apps downloaded from:“ section called „Anywhere“. If it’s not already selected click on the padlock in the lower left corner to unlock the settings (your admin password is needed) and then select this news option „Anywhere“.
Now try opening that app again. Did it work? Nice! You may want to activate the Gatekeeper again, just to be safe. This can be done by entering the following command in a Terminal window:
sudo spctl --master-enable
If your app still didn’t launch despite the above steps there’s more you can try.
With OS X Leopard Apple intruduced a feature called Quarantine. Here’s a citation from Apple’s release notes:
File Quarantine is a new feature in Leopard designed to protect users from trojan horse attacks. It allows applications which download file content from the Internet to place files in “quarantine” to indicate that the file could be from an untrustworthy source. An application quarantines a file simply by assigning values to one or more quarantine properties which preserve information about when and where the file come from.Apple Leopard Release Notes
When the Launch Services API is used to open a quarantined file and the file appears to be an application, script, or other executable file type, Launch Services will display an alert to confirm the user understands the file is some kind of application. If the file is opened, the quarantine properties are automatically cleared by Launch Services if the user has write access to the file.
These additional properties macOS stores with downloaded files are stored in so-called extended attributes. And there’s a command to simply delete all the quarantine extended attributes of a file (or folder, in case of apps). This is what you need to enter in a Terminal window:
sudo xattr -rd com.apple.quarantine /Applications/yourapp.app
Again, your admin password will be needed for this command.
Now try again. This time the app should launch! Does it? Write me a comment! 🙂
Additional background knowledge
For the curious and the commandline nerds: to find out what quarantine saves about your downloads try these steps. I just updated Slack and this is what I found out about the downloaded DMG file:
This was my source for this little forensic approach.
In very rare cases I still found another problem to be the cause for the app not launching: the actual binary didn’t have the appropriate executable flags. They somehow got lost in translation, er, download. So you might want to check, that the binary executable …
… has the executable flags set:
A simple Terminal command to set these three x flags is:
chmod a+x yourapp
Hope this helped! If so, you can make me happy by writing a comment. Thanks! 😊