Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attempting to remove Apple's quarantine gives error "xattr: [Errno 2] No such file or directory"

I am attempting to remove quarantine from file permissions on osx; a similar starting point as this question.

However, when attempting the solution that worked there, I get:

$ xattr -d com.apple.metadata:kMDItemWhereFroms myFile.pem
xattr: [Errno 13] Permission denied: 'myFile.pem'

When I follow this up by applying sudo, I get:

$ sudo xattr -d com.apple.metadata myFile.pem 
xattr: [Errno 2] No such file or directory: 'myFile.pem'

Anyone know what's going on here? My file clearly exists and I am unsure of what to try next.


Edit

Attempting to delete explicitly specified attribute still gives:

sudo xattr -d com.apple.metadata:kMDItemWhereFroms myFile.pem 
xattr: [Errno 2] No such file or directory: 'myFile.pem'
like image 787
mherzl Avatar asked Sep 19 '25 15:09

mherzl


1 Answers

In your second example you don't actually have a metadata attribute, i.e.

sudo xattr -d com.apple.metadata:kMDItemWhereFroms myFile.pem

Try listing the extended attributes first before removing them, which you can do via:

xattr -l myFile.pem

Then you should know which ones to delete/change in order to get the file unquarantined.

For example, if I do this on a .dmg file I see:

[~/Downloads]:;xattr -l yahoomessenger_3.0.2build235554.dmg com.apple.diskimages.fsck: 00000000 6A EE 43 E7 65 3C 02 09 FC CC FD EE C5 BA 6F 0C |j.C.e<........o.| 00000010 F4 8B 4F 34 |..O4| 00000014 com.apple.diskimages.recentcksum: i:9292877 on 0B331FCB-4DC8-39B4-A12B-3A71BF73FD03 @ 1341527466 - CRC32:$BA65FD8D com.apple.metadata:kMDItemDownloadedDate: 00000000 62 70 6C 69 73 74 30 30 A1 01 33 41 B8 ED A2 37 |bplist00..3A...7| 00000010 EA AD 71 08 0A 00 00 00 00 00 00 01 01 00 00 00 |..q.............| 00000020 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 |................| 00000030 00 00 00 00 13 |.....| 00000035 com.apple.metadata:kMDItemWhereFroms: 00000000 62 70 6C 69 73 74 30 30 A1 01 5F 10 42 68 74 74 |bplist00.._.Bhtt| 00000010 70 3A 2F 2F 78 70 2E 79 69 6D 67 2E 63 6F 6D 2F |p://xp.yimg.com/| 00000020 67 6A 2F 6D 73 67 72 2F 6D 61 63 2F 79 61 68 6F |gj/msgr/mac/yaho| 00000030 6F 6D 65 73 73 65 6E 67 65 72 5F 33 2E 30 2E 32 |omessenger_3.0.2| 00000040 62 75 69 6C 64 32 33 35 35 35 34 2E 64 6D 67 08 |build235554.dmg.| 00000050 0A 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00 |................| 00000060 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000070 4F |O| 00000071 com.apple.quarantine: 0002;533d6ab7;Safari;79D54B00-8D85-4DF7-BB49-AA9C69B9B6E9

So I see com.apple.quarantine and com.apple.metadata:kMDItemWhereFroms. I think just removing the quarantine attribute should do it.

And I see the edits you did, try simply doing xattr -d com.apple.quarantine /explicit/path/to/myFile.pem (i.e. pass along the exact filepath to the tool). No need to do sudo here.

like image 73
Michael Dautermann Avatar answered Sep 23 '25 05:09

Michael Dautermann