brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: xattr -l shows the hidden extra data that macOS attaches to a file

macOS
~/tips/tip-macos-xattr-l-list-quarantine

xattr -l ~/Downloads/app.dmg

Lists the extended attributes of a file, including the quarantine flag that macOS sets on downloads.

A file on a Mac can carry more than its content. Extended attributes hold things like where it came from, and xattr lets you read them.

xattr -l ~/Downloads/app.dmg
xattr ~/Downloads/app.dmg

Without options xattr lists the names of the attributes. With -l it also prints the values. For a download you will often see com.apple.quarantine, the flag Gatekeeper uses. It is a string with a score, the download time, the app that downloaded it and an event ID.

Knowing it is there explains why a file you got from a browser opens with a warning, while the same file copied from a USB stick does not.

You can write and delete attributes too: -w writes one and -d deletes one. Removing the quarantine flag with xattr -d com.apple.quarantine file skips the Gatekeeper check for that file.

The caveat is exactly that. I would only do it for something whose source I trust and have checked. Removing the flag is not a fix for “the app is damaged”, it is a decision to stop macOS from checking, so verify the publisher first. Also be aware that the quarantine attribute travels: Eclectic Light notes it is one of the stickiest attributes and propagates to files extracted from an archive. For the full list of options see man xattr on your own Mac.

Further reading: The Eclectic Light Company: extended attributes, Eclectic Light: from quarantine to provenance

More macOS tips System Settings > Accessibility > Hover Text > When using the pointer A Smart Folder in Notes collects notes by tag, checklist or date Type # in a Mac note to tag it, then filter by tag in the sidebar tmutil isexcluded ~/Projects/app/node_modules Crop an image in Preview by dragging a frame and clicking Crop All macOS tips (99) All topics

Link