Select the Details tab to see all the information attached to it. To delete it, click the Remove Properties and Personal Information link at the bottom of the dialog box. There, you'll be able to choose between wiping all metadata in one fell swoop, or deleting specific items.
Extended attributes are arbitrary metadata stored with a file, but separate from the filesystem attributes (such as modification time or file size). The metadata is often a null-terminated UTF-8 string, but can also be arbitrary binary data. One or more files may be specified on the command line.
Use the xattr
command. You can inspect the extended attributes:
$ xattr s.7z
com.apple.metadata:kMDItemWhereFroms
com.apple.quarantine
and use the -d
option to delete one extended attribute:
$ xattr -d com.apple.quarantine s.7z
$ xattr s.7z
com.apple.metadata:kMDItemWhereFroms
you can also use the -c
option to remove all extended attributes:
$ xattr -c s.7z
$ xattr s.7z
xattr -h
will show you the command line options, and xattr has a man page.
See Bavarious's answer.
Use xattr
with the -c
flag to "clear" the attributes:
xattr -c yourfile.txt
To recursively remove extended attributes on all files in a directory, combine the -c
"clear" flag with the -r
recursive flag:
xattr -rc /path/to/directory
Have a long path with spaces or special characters?
Open Terminal.app
and start typing xattr -rc
, include a trailing space, and then then drag the file or folder to the Terminal.app
window and it will automatically add the full path with proper escaping.
Try using:
xattr -rd com.apple.quarantine directoryname
This takes care of recursively removing the pesky attribute everywhere.
xattr ~/Desktop/screenshot\ 2019-10-23\ at\ 010212.png
# com.apple.FinderInfo
# com.apple.lastuseddate#PS
# com.apple.metadata:kMDItemIsScreenCapture
# com.apple.metadata:kMDItemScreenCaptureGlobalRect
# com.apple.metadata:kMDItemScreenCaptureType
xattr -d com.apple.lastuseddate#PS ~/Desktop/screenshot\ 2019-10-23\ at\ 010212.png
xattr -d kMDItemIsScreenCapture ~/Desktop/screenshot\ 2019-10-23\ at\ 010212.png
xattr -l ~/Desktop/screenshot\ 2019-10-23\ at\ 010212.png
# com.apple.FinderInfo
# com.apple.metadata:kMDItemScreenCaptureGlobalRect
# com.apple.metadata:kMDItemScreenCaptureType
xattr -c ~/Desktop/screenshot\ 2019-10-23\ at\ 010212.png
xattr -r ~/Desktop
xattr -rd com.apple.FinderInfo ~/Desktop
xattr -rc ~/Desktop
WARN: Once you delete these you DON'T get them back!
FAULT ERROR: There is NO UNDO.
I wanted to address the error's people are getting.
Because the errors drove me nuts too...
On a mac if you install xattr
in python, then your environment may have an issue.
There are two different paths on my mac for
xattr
type -a xattr
# xattr is /usr/local/bin/xattr # PYTHON Installed Version
# xattr is /usr/bin/xattr # Mac OSX Installed Version
So in one of the example's where -c
will not work in xargs is because in bash you default to the non-python version.
-c
/usr/bin/xattr -c
-c
/usr/local/bin/xattr -c
# option -c not recognized
My Shell/Terminal defaults to /usr/local/bin/xattr because my $PATH
/usr/local/bin:
is before /usr/bin:
which I believe is the default.
I can prove this because, if you try to uninstall the python xattr
you will see:
pip3 uninstall xattr
Uninstalling xattr-0.9.6:
Would remove:
/usr/local/bin/xattr
/usr/local/lib/python3.7/site-packages/xattr-0.9.6.dist-info/*
/usr/local/lib/python3.7/site-packages/xattr/*
Proceed (y/n)?
To Fix option -c not recognized
Errors.
xattr
you may have: pip3 uninstall xattr
Terminal
windows & quit Terminal
Terminal
window.xattr
command and it should now work.OR
If you want to keep the Python
xattr
then use
/usr/bin/xattr
for any Shell
commands in Terminal
Python's version of xattr
doesn't handle images at all:
Good-Mac:~ JayRizzo$ xattr ~/Desktop/screenshot\ 2019-10-23\ at\ 010212.png
# com.apple.FinderInfo
# Traceback (most recent call last):
# File "/usr/local/bin/xattr", line 8, in <module>
# sys.exit(main())
# File "/usr/local/lib/python3.7/site-packages/xattr/tool.py", line 196, in main
# attr_value = attr_value.decode('utf-8')
# UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 2: invalid start byte
Good-Mac:~ JayRizzo$ /usr/bin/xattr ~/Desktop/screenshot\ 2019-10-23\ at\ 010212.png
# com.apple.FinderInfo
# com.apple.lastuseddate#PS
# com.apple.metadata:kMDItemIsScreenCapture
# com.apple.metadata:kMDItemScreenCaptureGlobalRect
# com.apple.metadata:kMDItemScreenCaptureType
MAN PAGE for OSX xattr
MAN PAGE for Python xattr VERSION 0.6.4
NOTE: I could not find the python help page for current VERSION 0.9.6
Thanks for Reading!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With