Home > Wiki Tips

Check and Remove Extended Attributes (Xattr) from Files on Mac

Updated on Thursday, February 27, 2025

Written by

Jenny Zeng

Approved by

Jessica Shee

English Français Deutsch やまと Español Português

Summary: This article from iBoysoft explains what extended attributes on Mac are and how to remove extended attributes from Mac.

In computing, a file is more than its content. It's a combination of its content, name, structure, metadata, and extended attributes. These components work together to ensure the file can be stored, accessed, and managed efficiently by the operating system and applications.

Although extended attributes are not typically visible in Finder or standard file operations, you may still want to view or even remove them. For example, if you can't open an app downloaded from the internet, it's likely due to the quarantine extended attribute.

What are Mac extended attributes?

Mac extended attributes, often referred to as "xattrs," are a feature of the macOS file system that allows you to attach additional metadata or custom attributes to files and directories. These attributes are essentially small pieces of information that extend the standard file metadata (like file name, size, and permissions) without altering the file's actual content.

They are also widely used in Linux, BSD, and other file systems.

How to view extended attributes on Mac?

Extended attributes are stored separately in a file's metadata and can only be accessed using the xattr command in Terminal. They are named using a type signature, similar to preferences files, such as com.apple.FinderInfo. Some also have metadata subtypes, such as kMDItemIsScreenCapture.

To view them:

  1. Launch the Terminal app.
  2. Type the command below and hit enter.xattr file_path

Input xattr, leave a space, then drag and drop the file you want to check with to Terminal to get its file path, then press the Enter key. A sample command would be: xattr /Users/jenny/Desktop/Screenshot\ 2025-02-18\ at\ 5.15.29 PM.png

The sample input returns the following extended attributes:

In this example, you can find metadata utilized by Finder for displaying file tags and icons, metadata for tracking the last used date of the file, metadata for enforcing security policies, and metadata for identifying the file as a screen capture.

Here are some examples of extended attributes and their meanings:

com.apple.FinderInfoStores Finder-specific metadata such as label color, visibility, and icon placement.
com.apple.quarantineIndicates that a file was downloaded from the internet and may be quarantined for security reasons.
com.apple.metadata:kMDItemWhereFromsStores the source URL or location from which a file was downloaded.
com.apple.metadata:kMDItemDownloadedDateRecords the date and time when a file was downloaded.
com.apple.TextEncodingSpecifies the text encoding used for a file, such as UTF-8 or ASCII.
com.apple.ResourceForkStores legacy resource fork data, primarily used in older macOS versions.
com.apple.lastuseddate#PSRecords the last accessed date and time for a file.
com.apple.metadata:_kMDItemUserTagsStores user-assigned tags or labels for a file.
com.apple.metadata:kMDItemFSLabelSpecifies the Finder label color assigned to a file.
com.apple.metadata:kMDItemAlternateNamesStores alternate names or aliases for a file.
com.apple.metadata:kMDItemCommentStores user comments or notes associated with a file.
com.apple.metadata:kMDItemOMUserTagsStores OpenMeta user tags, used by some third-party applications.
com.apple.metadata:kMDItemFSContentChangeDateRecords the date and time when a file's content was last modified.
com.apple.metadata:kMDItemFSCreationDateRecords the date and time when a file was created.
com.apple.metadata:kMDItemFSNameStores the name of the file as it appears in the filesystem.

Share this article if you find it helpful!

 

How to delete extended attributes on Mac?

When encountering issues on Mac, for example, errors that prevent you from opening apps on Mac, like "app is damaged and cannot be opened," app cannot be opened because it is from unidentified developer," "apple cannot check it for malicious software," removing the quarantine attributes is the most effective solution.

You may also face other situations where you need to delete the extended attributes of a file on Mac. Here's how:

  1. Open the Terminal app.
  2. Find the extended attribute of the file you want to remove.xattr file_path
  3. Remove the extended attribute.xattr -d attribute_name file_path

For instance, if you can't open the app Cornerstone, removing its quarantine bit (e.g., xattr -d com.apple.quarantine /Applications/Cornerstone.app) will stop the built-in security check from examining the app and allow you to open it.

Help others remove extended attributes on Mac by sharing this post!