While checking out Activity Monitor, you noticed a couple of processes you don’t recognize: mds and mdworker. Neither have an icon, and they seem to be running constantly. Don’t worry, they’re harmless.
This article is part of our ongoing series explaining various processes found in Activity Monitor, like kernel_task, hidd, installd, and many others. Don’t know what those services are? Better start reading!
The two processes are part of Spotlight, the macOS search tool. The first, mds, stands for metadata server. This process manages the index used to give you quick search results. The second, mdworker, stands for metadata server worker. This does the hard work of actually indexing your files to make that quick searching possible.
Why Are mds and mdworker Using So Much RAM and CPU?
If you’ve recently migrated your files and apps from one Mac to another, it’s normal for mds and mdworker to take up a great deal of CPU power and memory. The same goes if you recently added a bunch of new files to your computer. The processes are both working to build an index of all your files, which is what will later power your fast searches.
How can you tell this is the case? Open Spotlight and you’ll see the word “Indexing” next to a progress bar.
If you see that message, you know that Spotlight is hard at work creating your index, and that’s the reason for the resource usage. This typically only takes a couple of hours, though this can vary depending on your hard drive and processor speed.
Spotlight is configured to not use up all your resources. If you’re doing something that’s processor intensive, these processes should back off. But if your Mac is left idle, and you’re not on battery power, Spotlight will feel free to use whatever resources are necessarily in order to build the database.
Rebuild Your Spotlight Index
If these processes never seem to finish their job, and are constantly using your CPU and memory days after the indexing began, there’s a chance your index is corrupted. Happily, you can fix problems like this by rebuilding the Spotlight index.
There are two main ways to do this. The first is to add your entire hard drive to the the Excluded Locations list, then re-add it. The second is to open the Terminal, then run the following command:
sudo mdutil -E /
Either way, your entire Spotlight index will be re-built, which again you can see by pulling up Spotlight and looking for the word “Indexing” at top left, alongside the progress bar. Once that process is done, mds and mdworker should stop taking up excessive CPU. If not, consider running First Aid to fix file system problems on your Mac, then re-building the index again. That will solve the problem in almost all instances.