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
| Flag | Meaning |
|---|---|
| -l | List the attributes with their values |
| -p | Print one named attribute |
| -w | Write one named attribute |
| -d | Delete one named attribute |
| -c | Clear every attribute on the file |
| -r | Work through a directory recursively |
Examples
xattr -l installer.dmgShows com.apple.quarantine on anything downloaded.
xattr -d com.apple.quarantine /Applications/App.appClears the flag behind the damaged app warning.
xattr -cr ./MyApp.appStrips 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