Meta information and attributes is complex thing and I am not qualified to cover it extensively. Nevertheless. Distinction should be made between:
- meta information in files (usually displayed in GUI like Finder)
- Extended File Attributes
It is my understanding that question is about meta information one can see using ⌘ + i in Finder and xattr
is not suited for that (it's for Extended File Attributes).
If you remove extended attributes with xattr -c my_file.pdf
it may seem that all attributes are removed (xattr my_file.pdf
returns nothing). However, Finder displays meta information in tact.
Built-in mdls
lists the metadata attributes for the specified file. The problem with mdls
is that attributes are in MacOS plist format which not match names of attributes one can see in Finder using ⌘ + i. Additionally it also displays mixed selection of meta information and extended file attributes as well as fact it allows listing but not editing.
For deleting pdf meta information one can use exiftool
and/or qpdf
(both are not built in).
To remove all meta information in my_file.pdf using exiftool:
exiftool -all= my_file.pdf
It removes meta information, but displays warning:
Warning: [minor] ExifTool PDF edits are reversible. Deleted tags may be recovered! - my_file.pdf
1 image files updated
Pending ones needs linearizing this file with qpdf to remove artifacts (creates new file) might be an option:
qpdf --linearize my_file.pdf my_new_file.pdf
...and then one can read something like Cleaning PDF metadata in depth and realize that nothing is certain except taxes and death.