Query Spotlight's Raw Syntax with mdfind
Use kMDItem attributes to search file metadata the Spotlight UI can't express, faster than find ever will.
Run `mdfind 'kMDItemAuthor == "Jane"'` or combine attributes like `kMDItemPixelWidth > 4000` to search raw metadata instantly.
01Command
Command
$ mdfind 'kMDItemPixelWidth > 4000 && kMDItemContentTypeTree == "public.image"'02What it does
mdfind queries the Spotlight index directly, so results return in milliseconds even across millions of files. The raw predicate language exposes hundreds of kMDItem attributes: content types, EXIF dimensions, PDF authors, ISO dates. Add -onlyin to scope a folder and -live to watch matches change in real time; use `mdimport -t -d2` to debug why a file isn't matching.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- macOS mdfind — find files by raw Spotlight queryEvidence: Documents mdfind's raw query strings, -onlyin, -name and -live flags.
Last verified: 2026-09-17 · Category: System & Settings