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 -d com.apple.quarantine clears the download flag on a file in the terminal

Terminal
~/tips/tip-terminal-xattr-remove-quarantine

xattr -d com.apple.quarantine ./tool

Removes the quarantine mark that makes Gatekeeper block a downloaded tool.

You download a command line tool from a project you trust, run it, and macOS says it can’t be opened. The block comes from an attribute added at download time.

Browsers and many other apps add com.apple.quarantine to every file they save, and Gatekeeper checks it the first time the file runs. For a single binary you trust, remove only that attribute:

xattr -d com.apple.quarantine ./tool

Running xattr -l ./tool before and after shows the attribute is gone.

For an app bundle, add -r so every file inside is cleared:

xattr -r -d com.apple.quarantine /Applications/SomeTool.app

I prefer this to xattr -c, which wipes every extended attribute on the file, including ones you may want, like Finder tags or where the file came from.

Please treat this as what it is: switching off a safety check for that file. Gatekeeper is there to stop unsigned or tampered software. Only do it for files from a source you trust, ideally after checking the published checksum with shasum -a 256. If you are not sure, check it first with spctl --assess, or use System Settings, Privacy & Security, Open Anyway, which does the same thing for one app with an explicit prompt.

Further reading: xattr man page (macOS), Gatekeeper and runtime protection (Apple Platform Security)

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link