How to Bypass the ‘App is damaged’ Error on macOS using the xattr Command

When you download an application outside of the official Mac App Store, macOS automatically quarantines the file as a security precaution. This feature, known as Gatekeeper, is designed to protect your system from malware. However, it frequently flags perfectly safe, open-source software with a terrifying error message: “[App Name] is damaged and can’t be opened. You should move it to the Trash.”

If you trust the developer and know the application is safe, you can manually override Gatekeeper and strip the quarantine attribute using a powerful Terminal command known as xattr.

Understanding the Error

When you see the “damaged” error, the app is rarely actually corrupted. macOS has simply attached an extended file attribute called com.apple.quarantine to the application bundle during the download process. Because the app lacks an official Apple developer signature, Gatekeeper refuses to run it.

How to Remove the Quarantine Attribute

You can remove this invisible tag using the macOS Terminal. You will need administrator privileges to complete this action.

  1. Open your Applications folder, go to Utilities, and launch the Terminal application.
  2. Open a separate Finder window and locate the application that is refusing to open (usually in your Applications or Downloads folder).
  3. In the Terminal window, type the following command followed by a single space (do not press Enter yet):
    sudo xattr -cr 
  4. Click and drag the problematic application from your Finder window directly into the Terminal window. Terminal will automatically paste the correct, exact file path for the app. The final line should look something like this:
    sudo xattr -cr /Applications/ProblematicApp.app
  5. Press Return.
  6. Terminal will prompt you to enter your Mac login password. (As a security feature, no characters will appear on screen while you type). Type your password and press Return again.

What Did This Command Do?

The xattr command modifies extended attributes on macOS files. The -c flag tells the system to completely clear all extended attributes, and the -r flag tells it to do this recursively (applying it to every single file hidden inside the .app bundle).

By executing this command, you have entirely wiped the com.apple.quarantine flag. You can now double-click the application in Finder, and it will launch normally without triggering the Gatekeeper warning.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.