Fix High CPU Usage from mds_store on macOS and Disable Spotlight Indexing

This article was converted by SimpRead, original URL blog.kelu.org

Recently, while using macOS, I noticed in htop that several CPU cores were running at 100% utilization. Upon further investigation, I found that the mds_store process was consuming a large amount of CPU resources, and the system was extremely sluggish (though not necessarily due solely to this process).

mds_store is part of macOS’s Spotlight indexing service, responsible for managing file metadata so we can quickly search files, emails, apps, and more via Spotlight. Whenever system files change—such as when files are created, modified, or deleted—mds_store performs re-indexing, which may consume significant CPU resources, especially in the following scenarios:

  • Frequent file changes: For example, heavy file operations such as development projects or downloading large files.
  • External hard drives or network drives: If external storage devices are connected, Spotlight will also index their contents.
  • Corrupted Spotlight index: Sometimes the Spotlight index becomes corrupted, causing the system to repeatedly attempt re-indexing.
  • Re-indexing after system updates: After major macOS updates, Spotlight needs to rebuild its index for the entire system.

High CPU Usage from mds_store

  1. Rebuild Spotlight Index: Sometimes issues with the Spotlight index can be resolved simply by rebuilding it. Open Terminal and run the following command to delete and rebuild the Spotlight index:
sudo mdutil -E /
  1. Exclude Specific Files or Folders: If certain folders don’t need to be indexed, you can exclude them from Spotlight:

    • Open System PreferencesSpotlightPrivacy.
    • Click the + button and select folders you don’t want indexed, such as external drives or development project directories.
  2. Disable Indexing on External Drives: When using external hard drives or network drives, Spotlight may try to index them as well. To disable indexing on a specific drive:

sudo mdutil -i off /Volumes/ExternalDrive

Replace ExternalDrive with the actual volume name. This prevents Spotlight from indexing files on the external drive.

  1. Check Large Files or Databases: Some large files (e.g., mail stores, photo libraries) may take Spotlight considerable time to index. If searching these data isn’t necessary, consider excluding them.

Disabling Spotlight Indexing

Sometimes we don’t need Spotlight’s global search functionality and may choose to disable Spotlight indexing entirely. It’s simple—you can fully turn off Spotlight via Terminal:

  1. Completely Disable Spotlight:
sudo mdutil -a -i off

This disables Spotlight indexing on all volumes. After this, the system will no longer create indexes for files, emails, etc., and search functionality will be disabled. To re-enable Spotlight later, just run:

sudo mdutil -a -i on
  1. Disable Indexing on a Specific Volume:
sudo mdutil -i off /Volumes/YourVolumeName

This disables indexing only on the specified volume, leaving search functionality intact elsewhere in the system.

  1. Disable the mds Process (Not Recommended):
    Actually terminating the mds and mdworker processes forcibly is possible, but macOS automatically restarts them periodically. Therefore, using the mdutil command is strongly preferred. If you insist on stopping the service directly, use:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

This stops the mds process, but I do not recommend it, as it might interfere with other system functions.

Although Spotlight is a powerful search tool in macOS, it can sometimes place a heavy burden on system performance. By adjusting Spotlight’s behavior according to actual needs—or even disabling it completely when necessary—you can significantly improve system responsiveness.