When I list the files in MacOS, it shows results like below:
1 | ~/Library/Fonts> ls -la |
What does the “@” sign here mean? The following answer comes from the post here.
That means the file has Extended file attributes. What is Extended Attribute?
Standard Attributes. For example, creation date, modification date, permission.
Extended Attributes. Stores extra, customizable, small info. For example, author name, file character encoding, short comments, security status.
Resource Fork. Widely used before Mac OS X , can be considered as a more elaborate extended attribute system, and may also hold main data of the file. (See: Mac OS X Resource Fork Tips)
Some related commands are listed below:
1 | # View Extended Attribute with ls. |
What to Put in Extended Attribute? Extended Attributes are name/value pairs. The names are Unicode characters of less than 128 bytes. (they are probably encoded in utf-8 or utf-16) The values can be text or binary, recommended to be less than 4 kibibit.
There’s no standardize structure for names. Anyone can add a attribute named for example “xyz” to a particular file. Apple recommends the use of reverse DNS naming scheme to prevent name clash. This is the same scheme adopted by Java. Example:
1 | com.apple.FinderInfo |
If you have a domain name, such as “example.com” then your attribute name for file of author can be “com.example.author”. If you don’t have a domain name, just make sure the name is not likely used by others.
In some case, if we want to remove all the extended attributes, such as removing the warnings that “the app is not from verified developer”, we can run the following command(from here):
1 | xattr -cr <file_or_dir> |