My understanding is that mdfind -onlyin /search/path <query> by definition yields a subset of mdfind <query> because... well, according to the manpages, -onlyin limits the search scope.

Yet, when I do

mdfind -onlyin /Volumes/together abcd

I get a list of files including the search string abcd but when I do

mdfind abcd

I get results from elsewhere on my system, but not from /Volumes/together/ So the results when using -onlyin is not a subset of global search.

What am I missing?

This is on macOS 12.6.

  • I suspect that's because Spotlight (what powers mdfind) is only searching in your primary disk by default. /Volumes/together is, most likely, a disk mounted at the Volumes mountpoint but it is not your primary disk. Now, if you specifically tell it to search there, with onlyin, it listens to you (but probably did not index in the first place).
    – JL Peyret
    Oct 30, 2022 at 2:00
  • @JLPeyret you are right, /Volumes/together/ is a samba share and your suspicion about what's going on makes sense, but if this is what's going on then I'm wondering how I can tell Spotlight to also search in that share by default. It doesn't make much sense for Spotlight to maintain an index for certain paths but only look at them when explicitly told to do so. There must be a way...
    – Christoph
    Nov 8, 2022 at 21:16
  • google "spotlight index network drive" ... However... I'd be cautious before doing it about checking out if people have had problems with doing that - there's a lot of verbiage around... Good luck, haven't done it myself so hesitant to post anything in the way of recommendations.
    – JL Peyret
    Nov 8, 2022 at 21:56


You must log in to answer this question.

Browse other questions tagged .