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?

2 Answers 2


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

  • Thanks for your suggestion. I tried (sudo) mdutil -i on /Volumes/photos.smb and get the following message: Indexing disabled.. This is not the result I was hoping for. BTW I am aware of the excellent exiftool, but I wanted a more native solution.
    – Manngo
    Commented Feb 2, 2017 at 0:03
  • @Manngo, I had done this under OS X 10.8.5 and it works fine. I tried this under macOS 10.12.2 and got Indexing disabled too. I even tried mounting to a folder in my Home Folder and also disabling SIP, nothing worked, got the same message. Searched Google and found nothing to help. If you can't enable Spotlight to index a network share, then my only suggestion is to use exiftool as it pulls info directly from the file, not an index. Commented Feb 2, 2017 at 3:20

Not an answer but a data point. I also checked this under MacOS 10.2 but unlike user3439894 I'm on .3 instead of .2. When I tried mdutil -i on a network smb volume (both with sudo and without) I get the response: "unexpected indexing state". mdutil -s for the same networked volume yields: "Server search enabled." In my case the difference may be that the networked share is on our MacOS 10.8 server. I encountered this answer while trying to figure out why tags put on a file in the Finder on the networked volume by a MacOS 10.12 machine do not appear when a different Mac running MacOS 10.10. I will have to see if a file tagged on the local Mac and then moved to the MacOS 10.8 server can have its tags read by the 10.10 Mac...


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .