There is a program provided by Apple to see most of the metadata in a file. It is nice to have the met data clearly arranged, but the catch is that you cannot delete it or I don't know how to delete it.

For example, there is a PDF file in front of me that contains the source, the author and my operating system version. I would like to change this. I tried to delete the source using "xattr -c".

It seems as if the information is in the file and not added attributes are from the system itself.

Does anyone know how to delete or change the metadata.

Many Thanks


Solution 1:

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.

Solution 2:

There is macOS file system metadata, and then there is PDF metadata. The PDF file format itself contains metadata for the Title, Creator, Author, encoding software used, creation Date and more. This is separate from the data that macOS can append to a file on its disks.

Various third-party apps, like Acrobat, PDFPen Pro, etc, provide dialogs to edit this data. You can also modify it with Automator.

You'd need to create a workflow that takes a PDF as input, and then changes the metadata to something else, which could be " ".

enter image description here

Note that it doesn't contain 'your OS', but the version of MacOS that made the PDF.

Note that you can't change the Encoding Software value.