Apple mdls (MetaData List) command on Networked Drive

I have discovered mdls as a way of extracting information from a (photo) file. However, I have found that it doesn’t seem to work properly if I am accessing the file over the network. Some of the meta data is missing, most notably the GPS data which is what I wanted most.

However, if I copy the file to a local drive, then the metadata is all there, and everything is fine again. This suggests that mdls is looking in the wrong place for some data … ?

It gets weirder depending on the network:

  • If I connect using SMB I get a limited selection of metadata
  • If I connect using NFS I get the message that it could not find the file at all.

How can I use successfully mdls on networked files?


Just an FYI, exiftool (which has to be installed) can pull all metadata from the file over the network without the need to have the network volume indexed.

That said, the most likely reason you're only getting some of the metadata is because indexing is most likely turned off on the network volume.

I tested this with an SMB Share to a Linux System and copied over some photos that I know contain GPS Info.

On first query I got the same results you did, a subset of the metadata, however upon turning indexing on using mdutil and letting the volume be indexed, then mdls returned all metadata including the GPS Info.

In Terminal use the following syntax, mdutil -i on mount_point, e.g.:

mdutil -i on /Volumes/Data

Also, you might want to read the manual page for: mdutil