Force-Index a File with mdimport
Push a specific file or folder into the Spotlight index, or preview its extracted metadata, with mdimport.
Run mdimport ~/Documents/file.pdf to index that path now, or mdimport -t -d2 file.pdf to just print the metadata Spotlight would extract.
01Command
Command
$ mdimport -t -d2 ~/Documents/report.pages02What it does
mdimport is the tool Spotlight uses to feed files through importer plugins; calling it directly forces a re-import of a path without waiting for Spotlight's own schedule. Running it on a stubborn file usually makes it searchable immediately, and it works on whole folders too. With -t -d2 the file is not indexed at all — instead mdimport prints every attribute (title, authors, dates, content snippet) the importer extracts, which is the fastest way to see why a file type is or isn't searchable.
03Risk
!Warning: -t is test-only: with it the file is NOT added to the index, so use plain mdimport for real indexing. Custom file types without a working importer will show few or no attributes — that is a plugin limitation, not a broken index.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- mdimport - Spotlight importer toolEvidence: Documents mdimport for importing a path into the Spotlight index and -t -d2 to test-print the extracted metadata.
Last verified: 2026-09-18 · Category: Files & Folders