mdworker, the worker that reads your files for Spotlight
mdworker and mdworker_shared open your files and read them for Spotlight. Measured: 82 workers in one hour, 21 importers, a manual page from 2006.
By Chethan Kumar S N · Updated
Drop a text file into Documents and count to four. By the time you finish, a process you never launched has opened it, read every word, measured it, and filed the result in a database. Search for a phrase from that file a second later and it is there. The process that did the reading is called mdworker, and on a modern Mac you will almost always meet it under its longer name, mdworker_shared.
The name decodes cleanly. Metadata, md, the same prefix as the rest of the family in the CoreServices Metadata framework. Worker, because unlike nearly every process in this series it does not end in d for daemon. It is not a daemon at all, sitting around waiting for work. It is a unit of work: spawned, run, gone. The server it answers to is mds, the metadata server, and the manual page gives the whole relationship in two sentences. mdworker is the metadata server worker process. It is used by mds to scan and index files as a volume is mounted or a file changes.
That page has a date at the bottom, January 19 2006, and Mac OS X above it. This worker has been reading files for Spotlight since before the iPhone existed. What it does with them has not stood still, and the live measurements below catch it doing something its 2006 authors could not have imagined. Most of the files it reads were touched through one app: the Finder process, whose every window, desktop icon move and copy lands in the same change diary these workers read.
Here is the machine it was measured on: macOS 27.0.1 on a MacBook Pro, 29 days of uptime, the same Mac this site’s other process pages are measured on.
The receipts
| What | Measured |
|---|---|
| Path | /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support, two binaries side by side: mdworker and mdworker_shared |
| Size | 1,704,512 bytes and 1,705,248 bytes, 736 bytes apart, same build date, same strings inside |
| Architectures | x86_64, arm64e and arm64e.x1 in both, so Intel Macs still get their workers |
| Signature | Apple platform binaries, identifiers com.apple.mdworker and com.apple.mdworker_shared |
| User | The logged in user, not root |
| Parent | launchd, process 1, measured on a live worker |
| Command line | mdworker_shared -s mdworker -c MDSImporterWorker -m com.apple.mdworker.shared, three flags naming the service, the client class and the mach service it hosts |
| Manual page | mdworker(8), dated January 19 2006, four sentences, see also mdfind(1), mdls(1), mdutil(1) |
| Churn | 82 distinct mdworker_shared process IDs in a one hour log window, zero plain mdworker |
| Lifetime | Six workers alive at one sample, each with 0.06 to 0.13 seconds of CPU used; one still there 58 seconds later, five gone |
| The family | Same folder holds mds, mds_stores, mdsync, mdwrite, mdflagwriter, corespotlightd, coreimportd and mdbulkimport, which has run the full 29 days as MDSImporterBundleFinder |
| Importers | 21 registered on this Mac: 18 Apple ones in /System/Library/Spotlight, plus Outlook’s own and two from Xcode |
The 736 byte gap between the two binaries is the whole plain-versus-shared story in miniature. They are the same program with the same strings, and the Mac measured here never once ran the short one in an hour of logs.
The search picture says people meet this name constantly and never by choice. The bare seed returns six suggestions, every one of them this process, three of them about the shared form: mdworker_shared, mdworker_shared mac, mdworker shared mac, mdworker, mdworker mac, mdworker shared. The phrase mdworker mac returns ten rows, all gold, including one in Russian, and the high cpu family is the strongest in this series so far: mdworker high cpu, mdworker high cpu usage, mdworker_shared high cpu, seven clean rows with no noise among them. The com.apple family runs three deep and the third row, com.apple.metadata.mdworker, is the real bundle identifier wearing a search bar. There is no mdworker virus row at all, which after twenty years of this process is its own kind of compliment.
The spawn machine
The command line is the machine’s own badge, worn in public. Three flags: -s mdworker names the service, -c MDSImporterWorker the client class, -m com.apple.mdworker.shared the mach service the worker will host. Parent process 1. That is launchd holding the door: mds decides a file needs reading, calls the service by name, and launchd materialises a worker for the job. Nothing sits idle between jobs. The worker’s whole life is the job.
The log shows the rhythm. Workers come up in pairs and triplets, seconds apart, siblings with consecutive process IDs, which is what a folder of changed files looks like from the inside: one worker per file, in bursts. Eighty two distinct workers passed through the sampled hour on a Mac that was, at that moment, mostly running a build. Every one of them began its short life by asking the membership system who the current user is, three lines apiece, the sound of a sandbox being fitted before any file is opened.
The churn explains the thing people actually notice in Activity Monitor: a count that will not sit still. Four workers, then nine, then two, then six, all afternoon. That is not a leak. Each worker is a job, and jobs end.
The cast list
A worker never reads a file itself. It hands the file to an importer, a plugin bundle with .mdimporter on the end, and the plugin knows the file type. The system keeps 18 of them in /System/Library/Spotlight, and the roster reads like a list of everything you keep on a disk: PDF, RichText, Office, iWork, Image, Audio, MIDI, Font, Archives, Application, Automator, CoreMedia, Mail, vCard, iCal, and two generations of iPhoto importer that are still shipping.
Applications can add their own. The command mdimport -L lists every registered importer on the machine, and on this Mac the list runs to 21: the 18 Apple ones, Microsoft Outlook Spotlight Importer from the Outlook application bundle, and a uuid.mdimporter from not one but two Xcode installs, one of them a beta. When Outlook wants its mail searchable, it ships the reader for it. That is the extension point: your apps quietly teach this worker their file formats.
One rule holds the whole arrangement together. An importer gets to read the file it was handed and almost nothing else. The seatbelt profile for the job, spotlight-import.sb, sits in /System/Library/Sandbox/Profiles and grants file reads through a sandbox extension named com.apple.spotlight.importer.readonly, plus scoped reads into the application bundle that shipped the importer. The binary’s own strings enumerate the same fence from the other side: home, app container, group container, temp directory, each one an extension to be granted, per import, by the thread that is about to open your file.
The test
The manual page names two triggers, so test both. Three files into a fresh folder in Documents: a text file with an author line in it, a markdown readme, a desktop wallpaper image. Within four seconds a new mdworker_shared was in the process list, process ID 66375, one more than the count before the drop.
What the worker left behind is visible with mdls, the attribute reader. The text file came back with a full set of content attributes, creation and modification dates, display name, and one row this series has never seen before: _kMDItemPrimaryTextEmbedding, a 1024 byte vector, version 10, computed from the words in the file. The worker did not just read the text. It embedded it. Somewhere in the pipeline between the 2006 manual page and macOS 27, this process learned to hand every file to a language model on the way to the index. The image came back with the Image importer’s work showing: 24 bits per sample, RGB colour space, and a content type tree rooted at public.heic.
The loop closes with mdfind, searching for a phrase from inside the file. One hit, the file itself, seconds old. Drop, read, embed, searchable: the whole life of a Spotlight result, and the worker was in the middle of all of it.
The same test explains a confusion people hit with mdls. Run it on a file in a folder Spotlight does not index, /tmp for one, and you get only kMDItemFS rows, the free filesystem attributes, name, size, dates. No content, no embedding. The filesystem knows the file exists. Only an indexed location has been read.
When the column climbs
Apple’s support article about Spotlight indexing states the trigger list itself: indexing happens when you first set up your device, after you install a software update or upgrade, and as data changes on your device. And the cost, in Apple’s words: depending on the amount of data on your device, Spotlight indexing can take hours or even days. That article never once names mdworker, even though it is the article’s own subject doing the work.
So the worker with the big CPU column is nearly always mid-backlog: an update just unpacked thousands of files, a migration copied a home folder, a backup restored, a cloud sync service landed a project. The waves of workers are the backlog being cleared, and they end. The levers, if they are ever needed, are in Spotlight settings and mdutil, and they turn off indexing for a place or a volume. There is no lever called mdworker, on purpose: there are no configurations to mdworker, the first manual page said so in 2006, and the one shipping today says the same.
Questions
What is mdworker on my Mac?
It is the worker process that reads files so Spotlight can find them. Apple's own manual page, mdworker(8), dated January 19 2006, says it in two sentences: mdworker is the metadata server worker process, used by mds to scan and index files as a volume is mounted or a file changes. The server, mds, decides what needs reading. The worker is the one that actually opens the file, hands it to the right importer plugin, and writes the attributes into the index. There is nothing to configure, and the same page ends with the standard warning that users should not run it manually. Apple's consumer documentation about Spotlight indexing never names it, which is why the bare process name looks alien in Activity Monitor.
What is mdworker_shared, and why do I see so many of them?
mdworker_shared is the modern form of the same worker, and the one a current Mac runs almost exclusively. On the measured Mac every single worker in a one hour log window, 82 distinct process IDs, was an mdworker_shared, and not one plain mdworker. Each copy runs the same importer machinery through a shared mach service, com.apple.mdworker.shared, which you can read straight off the process command line in Activity Monitor or ps. They are spawned per job and die when the job ends, so the count moves constantly: six were alive at one sample on this machine, one 58 seconds later, and five of the six were gone within minutes. A long column of them appearing and disappearing is the design working, not a malfunction.
Why is mdworker using so much CPU?
Because a batch of files needs reading. The worker's own manual page ties it to two triggers: a volume being mounted, and a file changing. Multiply that by a software update, a migration, a restore from backup, or copying a large folder somewhere Spotlight watches, and the system spawns workers in waves until the backlog is clear. Apple's own support article about Spotlight indexing says it plainly: depending on the amount of data on your device, Spotlight indexing can take hours or even days. The honest test is patience first. If the CPU never comes down over days, the levers that exist are the real ones: add the problem folder to the Search Privacy list in Spotlight settings, or turn indexing off for a volume with mdutil. There is no settings pane called mdworker because there is nothing about the worker itself to set.
Is mdworker a virus?
No, and the file answers for itself. It lives at /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support, on the sealed system volume that macOS verifies at boot, is signed as an Apple platform binary with the identifier com.apple.mdworker, and its parent is launchd, process 1, the same as every system service. Third party antivirus pages that list it as suspicious or optional are padding their tables with Apple's own filenames. What you can legitimately check if you are worried: the path. Anything calling itself mdworker from outside the Metadata framework, or from your Downloads folder, is not this process.
Can I quit or disable mdworker?
Quitting buys nothing. Kill one and the server spawns the next worker for the next file that changes; that on-demand arrangement is why the process count is a moving target all day. The manual page says there are no configurations to mdworker, so the dial that exists is indexing itself, not the worker. The switches are the Search Privacy list in Spotlight settings, which excludes a location, and mdutil with an off value per volume, which stops the index being maintained for it. Both trade search for quiet: whatever you exclude stops appearing in Spotlight, in Finder search, and in the Open dialogs of apps that use the same index.
What is the difference between mdworker and mds_stores?
One reads the files, one writes the database. mdworker opens documents and runs importer plugins over them to pull out attributes: authors, dimensions, camera models, the words in a text file. mds_stores is the database writer that files those attributes away into the store Spotlight actually searches. The two are colleagues in the same framework folder, alongside mds itself, the server that directs them, and a supporting cast that includes mdbulkimport, which has been alive on the measured Mac for the full 29 day uptime with the job title MDSImporterBundleFinder, finding importer bundles. If you want the whole index story including the store, that is the companion page on Spotlight indexing.
Ready? Buy Ribbon for $15, or read all the guides.