Mac process

What is mdworker on Mac?

If Activity Monitor shows ten or twenty mdworker_shared processes, don’t panic. Spotlight spawns them in parallel to read new and changed files, and they exit on their own when the queue is empty.

Process
mdworker
Comes from
macOS
Safe?
Safe. Spotlight worker processes; quitting one just skips that file for now.

What mdworker does

mdworker_shared is Spotlight’s file reader. When a file is created or changes, the coordinator mds hands it to a worker, which loads the right importer for that file type (PDF, Word, image, source code, a third-party format) and pulls out text, titles, authors, dimensions and other metadata. The worker passes the results to mds_stores, which writes them into the index.

On current macOS the process is named mdworker_shared and lives in /System/Library/Frameworks/CoreServices.framework/.../Metadata.framework/Versions/A/Support/. You may still see plain mdworker in older guides.

Why it uses CPU

  • Lots of new files: cloning repos, npm install, unzipping, copying photos. Every file is read once.
  • Huge or complex files: big PDFs, Office documents, and archives take seconds each.
  • A broken importer: a third-party .mdimporter that hangs or loops on its own file type.
  • A file that changes constantly: a log or database rewritten every few seconds gets reimported every time.

How to make it calm down

First, find what it is reading:

sudo fs_usage -w -f filesys mdworker_shared | grep -v /System | head -40

If the paths are all in one project or cache folder, exclude that folder in System Settings › Spotlight › Search Privacy (Sonoma: Siri & Spotlight › Spotlight Privacy).

List the installed importers and look for third-party ones:

mdimport -L 2>&1 | grep -v /System/Library

Importers live in /Library/Spotlight, ~/Library/Spotlight or inside app bundles. Removing or updating the app that ships a misbehaving one fixes it. To test whether a single file is the problem:

mdimport -d1 ~/path/to/file.pdf

If it takes a long time or errors, that file (or its importer) is your culprit.

When to worry

Real workers run from the Metadata framework path above, under your user, _spotlight or root. Check one:

ps -o user,pid,etime,command -p $(pgrep -n mdworker_shared)

A worker with etime of hours is stuck; quit it in Activity Monitor and Spotlight will spawn a fresh one. A process called mdworker running from your Downloads, /tmp or a hidden folder in your home directory is not Apple’s and should be checked with codesign -dv --verbose=2 <path>.

Seeing it in Stat Space

Stat Space files macOS daemons like mdworker_shared under one System group in the Apps tab, so twenty workers don’t push your real apps off the list. Expand the group and tap a process to see its user, parent, uptime, signature and open files: the open files list is often enough to see which document a stuck worker is chewing on.

Questions

Why are there so many mdworker_shared processes?

macOS runs several workers in parallel, separated by user and file type, so a crash on one weird file doesn’t stop indexing. They idle out after a minute or so with no work.

Is mdworker the same as mdworker_shared?

Yes, in practice. Older macOS versions ran mdworker; current versions run mdworker_shared. Same job: extract metadata for Spotlight.

Can a third-party app make mdworker slow?

Yes. Apps install Spotlight importer plug-ins (.mdimporter) so their file types are searchable. A buggy one can hang a worker or use CPU for minutes per file.

Get started

Know what your Mac is doing, without adding to it.

Free, no account. Pro is $9.99 once for the first 100 buyers.