Home·Terminal commands

xattr

Permissions

Usage

xattr -l [file]

Reads and removes extended attributes on macOS, most often com.apple.quarantine, the flag behind the app is damaged warning; Linux uses getfattr and setfattr instead.

Common flags

FlagMeaning
-lList the attributes with their values
-pPrint one named attribute
-wWrite one named attribute
-dDelete one named attribute
-cClear every attribute on the file
-rWork through a directory recursively

Examples

xattr -l installer.dmg

Shows com.apple.quarantine on anything downloaded.

xattr -d com.apple.quarantine /Applications/App.app

Clears the flag behind the damaged app warning.

xattr -cr ./MyApp.app

Strips every attribute through the whole bundle.

Numeric and symbolic modes name the same thing: 755 and u=rwx,go=rx are the same permission.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does xattr do?

Reads and removes extended attributes on macOS, most often com.apple.quarantine, the flag behind the app is damaged warning; Linux uses getfattr and setfattr instead.

Q. How do I type it?

xattr -l [file] — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

6 are listed here; the full set is in man xattr. This command sits under Permissions.

Related commands

man page: man xattr