The files on your Mac computer contain more than just the texts, images, or other data that an average user would typically think. Every file on your Mac is made up of different types of data and information, the most obvious of which include the date and time they were created. Other information can also be accessed by checking out Finder’s Get Info dialog. This information is what we call a file’s attributes. Aside from common data and info, a file may come with more extensive metadata. These are known as Mac file extended attributes or xattr in short. In this post, we’ll try to explain in the simplest way possible what these file extended attributes are and how you can remove and make use of them.
What Are Mac File Extended Attributes
Extended attributes are metadata components that are typically unique to every file and file types on your Mac. These attributes can be any of the following:
- Identifying data about the file
- Quarantine information
- File origin data
- Label information
Aside from these, there are also other more specific attributes that you might encounter as you explore the subject further.
Advanced Mac users can use extended file attributes for various purposes. They may review these extended attributes and remove them from a file or directory for some reason. Doing so will require the use of the command line. Note that removing attributes from a directory is not at all necessary and may be too complicated for an average user, so before you try meddling with them, make sure that you understand entirely:
Pro Tip: Scan your Mac for performance issues, junk files, harmful apps, and security threats
that can cause system issues or slow performance.
- What file extended attributes are
- Why they may or may not matter
- Why you would want or not want to remove them
How to View File Extended Attributes
The xattr command has been available in macOS and macOS X for quite a while, so you should be able to view extended attributes on a Mac running on any of the macOS versions from the last few years using these instructions:
- Open the Terminal app. You can search for it in Spotlight or go to /Applications/Utilities/
- Type the xattr command in this template: xattr ~/[file location]/[filename] . For example:
- Press Return and begin viewing the extended attributes for the specific file.
Now, you will see metadata information that can be used for various Finder and Spotlight search features, as well as quarantine data, which are likely tied to data you have downloaded from the web or a third-party app. And speaking of quarantine data, a prime example of this is when you get a message along the lines of “file or app can’t be opened because it is from an unidentified source or developer.” When Gatekeeper quarantines a file or app, an extended attribute is created.
How to Remove Extended File Attributes From a File on Your Mac
To remove an extended attribute for a file, you need to use the Terminal app again. By now, you’re probably accustomed to using the command line, so here are the steps to proceed:
- Open the Terminal app.
- View the extended attributes using the steps above.
- Locate the file you want to remove.
- Type in the xattr command with -d flag on the file. For example:
xattr -d com.apple.metadata:kMDItemIsScreenCapture~Desktop/softwaretested.jpg
- Press Return to get the command into action.
Your Mac comes with various functions and features that you may find useful. If you’re looking to manage junk files and optimize RAM, Outbyte macAries is one app that claims to help with this. Ensure that the software fits your specific system maintenance needs.