Use the xattr tag for questions about extended attributes on files in a (Linux or macOS) file system.
Extended attributes are descriptions of the file stored separately from the file data. They are read by special system calls. People often first encounter them as a result of seeing an @
after the permissions in the output from ls -l
. (The related symbol, a +
, indicates that there are ACLs — access control lists — associated with the file.)
On macOS (or Mac OS X), you find out about the extended attributes with the @
option to ls
. For example, a file might have the extra attribute:
$ ls -l@d Cscope
drwxr-xr-x@ 3 someuser staff 102 Mar 8 21:49 Cscope
com.apple.quarantine 30
$
indicating that the directory had been copied from the internet and had not yet been marked as clean/safe. The Time Machine software makes extensive use of extended attributes too.
For macOS, the system calls are listxattr()
, flistxattr()
getxattr()
, fgetxattr()
, removexattr()
, setxattr()
. Linux adds lgetxattr()
to this set.