7

I downloaded and extracted an archive from GitHub (Homebrew/brew) into a temporary directory under /root (with help from sudo). If I do ls -l I see an extended attribute:

total 0
drwxr-xr-x@ 16 root  wheel  512 Jul  2 09:30 brew-master

If I do ls -l@ (thanks to this answer to this question) I get the following output:

total 0
drwxr-xr-x@ 16 root  wheel  512 Jul  2 09:30 brew-master
    com.apple.quarantine     59 

If I do ls -l@ brew-master I get the following output:

total 48
-rw-r--r--@  1 root  wheel    98 Jul  2 09:30 CHANGELOG.md
    com.apple.quarantine      59 
-rw-r--r--@  1 root  wheel  3161 Jul  2 09:30 CODE_OF_CONDUCT.md
    com.apple.quarantine      59 
-rw-r--r--@  1 root  wheel   720 Jul  2 09:30 CONTRIBUTING.md
    com.apple.quarantine      59 
-rw-r--r--@  1 root  wheel  1334 Jul  2 09:30 LICENSE.txt
    com.apple.quarantine      59 
drwxr-xr-x@  7 root  wheel   224 Jul  2 09:30 Library
    com.apple.quarantine      59 
-rw-r--r--@  1 root  wheel  7374 Jul  2 09:30 README.md
    com.apple.quarantine      59 
drwxr-xr-x@  3 root  wheel    96 Jul  2 09:30 bin
    com.apple.quarantine      59 
drwxr-xr-x@  5 root  wheel   160 Jul  2 09:30 completions
    com.apple.quarantine      59 
drwxr-xr-x@ 48 root  wheel  1536 Jul  2 09:30 docs
    com.apple.quarantine      59 
drwxr-xr-x@  5 root  wheel   160 Jul  2 09:30 manpages
    com.apple.quarantine      59 

This answer to this question tells me to do xattr -d to clear the attribute but it would only work on a single file or directory entry.

How can I clear this attribute recursively?

P.S. If I would unzip the download into a non-root subdirectory I seem to get a similar quarantine attribute.

2 Answers 2

10

Quick and easy solution (combination of this answer to this question and this blog post):

xattr -cr brew-master

(using sudo if and only if this is within root directory)

Slightly more refined solution from the same blog post:

xattr -r -d com.apple.quarantine brew-master

An even better solution would be to use command-line tools to fetch and extract such an archive in order to avoid this kind of issue in the first place. This kind of solution is part of my answer on how to install Homebrew manually.

4
  • As of Sonoma 14, the option -r has been removed for some unexplained reason.
    – user148298
    Commented Dec 20, 2023 at 18:48
  • 2
    I noticed that on my Sonoma installation, the xattr in homebrew (/opt/bin/xattr) doesn't have the -r option but /usr/bin/xattr does. Hmmm. Commented Mar 7 at 17:47
  • This worked for me, but I had to move the folder outside of ~/Downloads first, otherwise com.apple.macl was being reapplied to the file while processing it.
    – GM Lucid
    Commented Mar 8 at 2:48
  • @user148298 it is not removed, make sure you're calling the macOS xattr, which is /usr/bin/xattr. In my case, the one installed by pip doesn't have that option. @DylanMcNamee according to this issue, Apple modified xattr but didn't submit it to upstream, that's why -r option only exists in /usr/bin/xattr.
    – Bruce Sun
    Commented May 16 at 12:54
1

This can be done without brew, this way:

xattr -r -d  com.apple.metadata:kMDItemWhereFroms /Users/MyUserName/Downloads/FolderContainingFilesAndOtherFolders

To remove those datas from anything in a particular folder.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .