When you save files to disk on your Mac, OS X will include a number of metadata information along with the file, which programs and services such as the Finder might use to sort and search for items. If you need to look at any of this metadata for a file, then there are several ways you can do so.
The first of these is the simple Finder information window, which can be invoked by selecting a file and pressing Command-i. This will show you a number of details such as the file’s kind, size, location, and dates created and modified. In addition, you can expand the “More Info” section to view additional metadata.
Some file metadata can be located in these fields of the Finder’s information window (click image for larger view).
The metadata in the “more info” field will be file-specific, so for instance you may see dimensions, resolution, color space, and alpha channel properties for an image file, but for a music file you might see genre, composer, duration, channel number, and sampling rate details. Also keep in mind that these will depend on whether or not the file was appropriately tagged with this metadata information.
While the Finder information window will show you these details, this may only be a subset of the metadata that a file contains. To see these details in-depth, you will need to use the Terminal’s “mdls” command, which will list all the metadata tags and values bound to a specific file:
- Open the Terminal.
- Type “mdls” followed by a single space.
- Drag the desired file from the Finder to the Terminal window, or otherwise target the file using Unix file path syntax.
- Press Enter to run the command on the file.
When this procedure is done, you will see a listing of all the metadata keys associated with the file, and their corresponding values. The key names will usually begin with “kMDItem” followed by additional details on the name, such as “kMDItemContentCreationDate” for the file’s creation date field. Following this name, you will see an equals sign and then the metadata key’s value.
The Terminal’s “mdls” command will show the full listing of metadata for the specified file (click image for larger view).
In addition to listing all of the file’s metadata, you can target a specific metadata key to only view that key’s value. To do this, simply run the “mdls” command in the following manner:
mdls -name KEY FILEPATH
In this case, KEY will be the name of the metadata key you are interested in looking up for the file specified by FILEPATH. There are many different keys you can use, some of which may be unique for a specific file type, but the following list is some of the potentials (by no means all of them) and common ones that you might find used:
Fonts:
com_apple_ats_name_family com_apple_ats_name_fond com_apple_ats_name_full com_apple_ats_name_postscript com_apple_ats_name_style
com_apple_ats_names