Spotlight/QuickLook/DNS/font caches

mds & mdworker Using High CPU on Mac? How to Tame Spotlight Indexing (2026)

Open Activity Monitor and you see mds high cpu mac — sometimes pegging one or more cores at 80–100% for minutes or even hours. The culprit is Spotlight, Apple's system-wide search index. mds (Metadata Server) is the daemon that orchestrates indexing, while mdworker and mdworker_shared are the worker processes that read every file and extract its metadata. On Apple Silicon Macs this usually settles quickly; on older Intel machines — or after a large file operation — it can linger. This guide explains why the spike happens, how to tell when it's safe to leave alone, and what to do when it genuinely gets stuck.

What Are mds and mdworker, Exactly?

macOS Spotlight maintains a private index stored at /private/var/db/Spotlight-V100/ (system volumes) and ~/.Spotlight-V100/ inside some external drives. The index maps every word, attribute, and metadata tag on your disk so that Spotlight, Quick Look previews, Siri suggestions, and third-party apps that use NSMetadataQuery can respond instantly.

  • mds — the coordinator. It watches the filesystem via FSEvents and schedules work.
  • mdworker — the importer. One or more workers run in parallel, calling content-importer plug-ins for each file type (PDF, DOCX, source code, images, and so on).
  • mdworker_shared — a sandboxed variant introduced in recent macOS releases for processing untrusted file types with tighter restrictions.

None of these are malware. They are signed Apple system processes and cannot safely be killed permanently — macOS will relaunch them.

Why Does the CPU Spike Happen?

Spotlight has to (re)index a file every time its content or metadata changes. The most common triggers:

  • macOS upgrade or first boot. Sequoia and Tahoe both refresh the index schema on major updates, forcing a full re-scan.
  • Large downloads or copies. Dropping thousands of files into ~/Downloads queues them all simultaneously.
  • Developer build artifacts. Xcode's ~/Library/Developer/Xcode/DerivedData can contain hundreds of thousands of object files. Each build adds new files; Spotlight wants to read every one.
  • Node.js projects. node_modules directories inside ~/Developer or ~/Projects routinely hold 50,000–200,000 small files — a feast for mdworker.
  • Rust and Maven caches. ~/.cargo/registry and ~/.m2/repository accumulate tens of gigabytes of source tarballs and class files over time.
  • External drives or NAS mounts. Plugging in an unindexed volume starts an index pass from scratch.
  • Corrupt or stuck index. Rare, but the index database can become inconsistent, causing mds to loop endlessly.

How Long Should You Wait?

On a modern Apple Silicon Mac with an SSD, a normal first-boot Spotlight index typically finishes within 15–45 minutes. On Intel or after a very large file operation, allow up to a few hours. You can check progress in System Settings → Siri & Spotlight → Spotlight Privacy: a progress bar appears below the search field while indexing is active. If CPU stays elevated for more than four hours without any obvious new file activity, you may have a stuck index.

Common Folders That Fuel mds — and Their Sizes

The table below shows typical folder sizes that force heavy Spotlight re-indexing. Excluding them (covered in the next section) stops mds from chasing files you never search by content.

Folder / Cache Typical Size Why Spotlight Loves It
~/Library/Developer/Xcode/DerivedData 10–60 GB Hundreds of thousands of object files, each re-written on every build
node_modules (any project) 200 MB – 2 GB per project 50,000–200,000 small JS/TS files per install
~/.cargo/registry 2–15 GB Rust source tarballs and compiled artifacts accumulate across crates
~/.m2/repository 1–20 GB Maven JAR and POM files, one per dependency version
~/Library/Caches 2–30 GB App caches with frequent writes (browser, Xcode, CocoaPods)
External drives / NAS volumes Varies Indexed from scratch each time they mount

If you want a broader look at what's eating your disk overall, the guide on what is taking up space on my Mac walks through every major storage category.

How to Exclude Folders from Spotlight (Step-by-Step)

The single most effective fix is telling Spotlight to ignore folders it doesn't need to search.

  1. Open System Settings (macOS Ventura and later) or System Preferences on older macOS.
  2. Go to Siri & Spotlight (Ventura+) or Spotlight.
  3. Click the Privacy tab.
  4. Click the + button and add the folders you want to exclude. Recommended candidates:
    • ~/Library/Developer/Xcode/DerivedData
    • Any node_modules parent directory, or add individual project roots
    • ~/.cargo
    • ~/.m2
    • Any external drive you use only for backups or media storage
  5. Click Done. Spotlight immediately removes those paths from the queue — you should see mdworker CPU drop within a minute or two.

You can also drag-and-drop folders directly into the Privacy list from Finder.

How to Rebuild a Stuck Spotlight Index

If CPU stays pegged and no progress bar appears, a corrupt index may be the cause. The cleanest solution is to force a full rebuild from Terminal:

  1. Open Terminal (/Applications/Utilities/Terminal.app).
  2. Run the following two commands in order. The first turns off indexing; the second turns it back on and triggers a clean rebuild:
    sudo mdutil -a -i off
    sudo mdutil -a -i on
  3. Enter your administrator password when prompted.
  4. Wait for the new index to complete. Monitor progress in System Settings → Siri & Spotlight.

If you want to target a single volume (for example, your main disk at /) rather than all volumes, replace -a with the volume path: sudo mdutil -i off / then sudo mdutil -i on /.

Erasing the Index Database Manually

In severe cases you can delete the index files themselves before re-enabling indexing:

sudo mdutil -a -i off
sudo rm -rf /.Spotlight-V100
sudo mdutil -a -i on

macOS will recreate the .Spotlight-V100 directory and rebuild from scratch. This is safe — you lose nothing except the index itself, which will be reconstructed.

Permanent Developer Workflow Fixes

Excluding folders helps, but the underlying issue is often accumulation of caches and build artifacts. Cleaning them regularly keeps both disk usage and indexing load low.

  • Xcode DerivedData: Delete via Xcode → Settings → Locations → Derived Data → arrow icon, or run rm -rf ~/Library/Developer/Xcode/DerivedData in Terminal. Safe to delete at any time; Xcode rebuilds it on the next build.
  • node_modules: Run npm ci or yarn install to reinstall when needed. See also the guide on cleaning up node_modules on Mac for bulk removal across projects.
  • Rust crate cache: cargo cache --autoclean (requires the cargo-cache crate) or manually prune ~/.cargo/registry/cache.
  • Maven local repo: mvn dependency:purge-local-repository removes unused artifacts without breaking active projects.
  • General caches: ~/Library/Caches contains per-app cache folders. Most are safe to delete when the owning app is closed; the app recreates them on next launch.

A tool like Crumb can audit all of these locations at once and show you exactly what's safe to remove before anything is deleted — useful if you're not sure which caches belong to which apps.

When mds CPU Is a Sign of Something Else

Occasionally, high mds CPU is a symptom rather than the root cause:

  • Malware writing files at high speed. If mds is spiking continuously for days and you haven't done any large file operations, run a malware scan.
  • iCloud Drive sync loops. Files stuck in a sync-upload-delete cycle appear as constant new writes to FSEvents, which keeps mds busy. Check ~/Library/Mobile Documents for unexpected churn.
  • Time Machine backup in progress. Time Machine prepares snapshots by scanning files; this naturally triggers Spotlight activity on the same files. Wait for the backup to finish.
  • Virtualization app disk images. Parallels or VMware disk images stored in an indexed location can cause mds to try importing binary blobs. Move disk images to a Spotlight-excluded folder.

In each of these cases, fixing the underlying cause — not just excluding folders — is the right long-term solution.

Reclaim your disk in one click

Crumb audits your whole Mac, tells you what's safe to delete, and frees the space in seconds — private, local, and Apple-notarized.

Download Crumb for macOS

Frequently asked questions

Is mds a virus or malware?
No. mds (Metadata Server) is a signed Apple system process responsible for Spotlight search indexing. It cannot be safely disabled permanently, but it is completely benign. If you are uncertain, verify the process in Activity Monitor — it will show Apple Inc. as the responsible party.
How long does mds high CPU last after a macOS update?
On Apple Silicon Macs with an SSD, initial indexing after a major macOS update typically completes within 15 to 45 minutes. Intel Macs or machines with very large disks may take 2 to 4 hours. If it runs longer than that with no new file activity, a stuck index is likely — follow the mdutil rebuild steps above.
Will excluding a folder from Spotlight cause me to lose search results for it?
Yes, but only for Spotlight specifically. Files in excluded folders will not appear in Spotlight or Siri Suggestions. You can still find them in Finder using Command-F, or in Terminal with find and grep. Exclude only folders you never search by content, like build artifacts and package caches.
Where does Spotlight store its index and how much space does it use?
The main Spotlight index lives at /private/var/db/Spotlight-V100/ and typically ranges from 500 MB to 3 GB depending on how many files are on your drive. External volumes store a small .Spotlight-V100 folder at their root. Deleting and rebuilding the index is safe and reclaims any bloated index space.
Can I turn off Spotlight indexing permanently?
You can disable it system-wide with sudo mdutil -a -i off, but this breaks Spotlight search, Siri Suggestions, Quick Look metadata, and any app that relies on NSMetadataQuery. The practical approach used by most developers is to keep Spotlight on but exclude noisy build and cache directories rather than disabling the whole service.