mdworker_shared high CPU on Mac: how to fix it
Safe to quit? SometimesMade by Applemdworker_shared
mdworker_shared is Spotlight reading your files. Why there are so many, why they use CPU, and how to fix it when it doesn't settle.
mdworker_shared is a Spotlight worker: a small macOS process that opens your files and reads out their text and details so Spotlight can find them. It is made by Apple, it is not a virus, and it is normal to see several copies running at once.
Spotlight starts them when files need indexing and ends them when the work is done. Lots of busy workers simply means lots of files have changed.
What mdworker_shared does
Apple's manual page for mdworker describes it as the metadata server worker, used by mds to scan and index files as a volume is mounted or a file changes. On recent versions of macOS the workers appear as mdworker_shared.
Each worker uses an importer, a small plug-in that understands one kind of file, such as PDF, rich text, audio or iWork documents. The worker opens the file, the importer pulls out the title, author, text, dates and other details, and the results go to mds_stores for the index.
You can list the importers macOS uses. This only reads:
mdimport -L
On the Mac we checked, all 18 importers were Apple's own, in /System/Library/Spotlight. An app that adds its own importer shows up here with its own path.
Is mdworker_shared a virus?
No. Check any copy you are unsure of. To list every worker with its full path, run:
ps -Ao pid,comm | grep mdworker_shared
Each line should end in:
/System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker_shared
Then check the signature. This only reads:
codesign -dvv /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker_shared 2>&1 | grep -E "Identifier|Authority"
The genuine file shows:
Identifier=com.apple.mdworker_shared
Authority=Software Signing
Authority=Apple Code Signing Certification Authority
Authority=Apple Root CA
Most workers run under your own user account, which is expected: they index files you own. A worker running from anywhere outside /System is not Apple's, and the guide to checking a Mac for malware explains what to do next.
Why mdworker_shared uses high CPU
Workers are busy whenever there are files to read:
- Many new or changed files, after a big download, a copy, an unzip or a restore.
- A macOS update, which can lead Spotlight to re-index.
- Folders that change constantly, such as
node_modules, Xcode's DerivedData, virtual machine disks, or a sync folder in the middle of a big upload. - Large or unusual files, such as huge PDFs or archives, that take longer to read.
- A faulty importer from an app, which can make a worker spin on one file.
What is normal
On the Mac we checked, between six and nine workers were running during ordinary use, each using a few percent of CPU at most and often nothing. During indexing, several can be busy at once, together using a lot of CPU and disk. That is fine for a while. A single worker pinned at high CPU for a long time with nothing else changing is the case to look into.
How to fix high mdworker_shared CPU
- Wait for indexing to finish. Keep the Mac awake and on power.
- Restart. Apple menu > Restart ends any worker stuck on one file.
- Find what is changing. In Activity Monitor, double-click a busy worker and open Open Files and Ports. The file it is reading is often listed, which points to the folder causing the work.
- Exclude that folder. Go to System Settings > Spotlight (Siri & Spotlight on some versions) > Search Privacy (Spotlight Privacy on some versions) and add it. Apple's steps are in preventing Spotlight searches in files.
- Update or remove an app with a misbehaving importer. If
mdimport -Lshows a third-party importer and its file type is what workers keep reading, update that app. - Rebuild the index as a last resort, using Apple's method in About Spotlight indexing.
What not to do
- Do not keep force quitting workers. Spotlight starts another one for the same file.
- Do not delete files in /System or the Spotlight index folder. System Integrity Protection protects them for good reason.
- Do not disable Spotlight entirely. Excluding a few busy folders fixes the problem without breaking search in Finder and Mail.
How to see mdworker_shared in Activity Monitor
- Open Activity Monitor from Applications > Utilities.
- Choose View > All Processes.
- Type mdworker in the search field to see every worker.
- Sort by % CPU on the CPU tab. Workers come and go, so the list changes as you watch.
- Double-click a worker, then use Open Files and Ports to see which file it is reading.
How Headroom helps
Headroom's Speed screen shows your apps, not macOS's own processes, so Spotlight workers do not appear in its list. It does show the live CPU and memory pressure of the whole Mac and whether it is running cool, warm or hot, so you can tell a brief indexing spell from a real problem, with Quit buttons for your heaviest apps. The free Clean scan lists old build folders that keep the workers busy; clearing them needs the $19 licence.
Download Headroom, read about the Mac performance monitor, or see pricing.
Questions
Why are there so many mdworker_shared processes?
Spotlight starts several workers so it can index more than one file at a time, and it ends them when the work is done. Seeing a handful, or more during heavy indexing, is normal.
Is mdworker_shared a virus?
No. It is a Spotlight worker that is part of macOS. The real one runs from /System/Library/Frameworks/CoreServices.framework and is signed by Apple.
Can I force quit mdworker_shared?
You can, and it does no harm, but Spotlight starts a new worker and carries on with the same file. It only helps if one worker is stuck on a single file for a long time.
How do I stop mdworker_shared using so much CPU?
Let indexing finish, restart if it seems stuck, and exclude folders that change constantly, such as build output or virtual machines, in Spotlight's Search Privacy list.