How-to
How to search inside files on a Mac
You remember a phrase from a document but not the file name. macOS can already search inside files — here's how to do it with Spotlight, Finder and Terminal, where each one falls short, and what to do when they aren't enough.
1. Spotlight
Press ⌘ Space and type a few words from the document. Spotlight searches file names and the text inside files it has indexed, including PDFs, Word, Pages and plain text.
- Put an exact phrase in quotes:
"net 30 days". - Add a kind to narrow it down:
invoice kind:pdf. - Scroll down to the documents section, or choose Search in Finder at the bottom to see all matches.
Good for: a quick lookup when your words are distinctive.
2. Finder's Contents search
- Open a Finder window and press ⌘ F.
- Type your words, then choose Contents (not Name) in the menu that appears under the search field.
- Choose where to search: This Mac or the current folder.
- Click + to add criteria such as Kind, Last modified date or Created date.
You can save the search with Save — it appears in the Finder sidebar as a Smart Folder that updates by itself.
Good for: narrowing down by folder, kind and date, and keeping a search you run often.
3. Terminal: mdfind
mdfind queries the same index as Spotlight, which is handy for long result lists or scripts.
mdfind "late payment"
mdfind -onlyin ~/Documents "invoice"
mdfind -name "contract"
mdfind 'kMDItemTextContent == "*overdue*"cd'
The last form searches only the text content, ignoring case (c) and accents (d).
4. Terminal: grep for plain-text files
For code, Markdown, logs and other plain-text files, grep reads the files directly and doesn't depend on any index:
grep -ril "late payment" ~/Documents
-r searches folders recursively, -i ignores case and -l lists matching file names. It can't read inside PDFs or Office documents, and it's slow on large folders.
When files don't show up
- Check Spotlight's exclusions. Folders in System Settings › Spotlight › Search Privacy are never indexed.
- Check indexing status.
mdutil -s /shows whether indexing is on for your startup disk. - Rebuild the index.
sudo mdutil -E /erases and rebuilds Spotlight's index for the startup disk; it can take a while. - Cloud-only files. Files in iCloud Drive or other cloud folders that are only in the cloud have no local content to search. Download them first.
- Scanned PDFs. A PDF that's just an image of text has no text to find unless it's been through OCR.
What the built-in tools can't do
Spotlight, Finder and mdfind match the words you type. They don't help when:
- You remember the meaning, not the wording — you search "refund policy" and the document says "returns and reimbursements".
- You need to see why a file matched — results are file names, so you open each one to find the passage.
- The document is long — you find the right 60-page PDF, then search inside it again.
When a dedicated app helps
Several Mac apps add to what's built in — see our roundup of Spotlight alternatives. Memtrove is the one we make:
- Search by meaning as well as by name and content, so "contract about late payment fees" finds it even when those words aren't in it.
- Every result says why it matched — in content, in file name or by meaning — and the preview opens the matching section of the document.
- Plain-word filters like
last month in Downloads "net 30 days". - Your own index, on your Mac, independent of Spotlight's settings.
- Optional AI apps: let Claude search and read your files.
Frequently asked questions
Can Spotlight search inside PDFs?
Yes, if the PDF contains real text and the folder is indexed. Scanned PDFs without a text layer can't be searched until they've been through OCR.
Why doesn't Finder find text I know is in a file?
The usual causes: you searched Name instead of Contents, the folder is excluded in Spotlight's Search Privacy settings, the file is cloud-only, or the Spotlight index needs rebuilding.
How do I search inside files in one folder only?
In Finder, open the folder, press ⌘ F and choose the folder name instead of This Mac. In Terminal, use mdfind -onlyin /path/to/folder "words".