There are dozens of processes running on your Mac at any given time. Some of them are controlled by applications you’re working in, and others are run by the operating system to keep your Mac working as it should. Many of them have obscure names that make them very difficult to identify. In this article, we’ll take a look at mdworker and its close relative, mds.
What is mdworker?
It’s a process that runs in the background on your Mac. Mdworker is short for metadata server worker. And mds is short for metadata server. These are processes used by Spotlight to index your Mac. So, for example, if you copied lots of data to your Mac from somewhere else, you would notice mds and mdworker running in Activity Monitor.
Why do mds and mdworker consume so many resources?
Despite the fact that both processes can use lots of CPU cycles, they should never interfere with the running of your Mac. That’s because Spotlight is designed to not use up resources indexing your Mac while you are doing other CPU-intensive work or are running a MacBook on battery power. However, building and updating a Spotlight index can be quite hard work, so if you notice that mds and mdworker are using lots of resources and they are not slowing your Mac down, don’t worry about it.
How to prevent mds and mdworker using too many resources
The first thing to do is to check that mds and mdworker are actually running. The quickest way to do that is to click on the Spotlight icon in the menu bar (or press its keyboard shortcut Cmd-Space) and start typing a search term. If those processes are running, you will see a message just under the search bar that says ‘Indexing…’.
If you don’t see that message, you will know that whatever is slowing your Mac down isn’t mds or mdworker.
If you do see that message, it may be that mds and mdworker are doing what they are supposed to do, so the next step is to check Activity Monitor to see the resources they are using.
1. Check processes with Activity Monitor
- Go to Applications > Utilities and open Activity Monitor (you can also do it by typing its name in Spotlight and pressing Return when it appears).
- Click on the CPU column to order processes by how many CPU cycles they’re using.
- If mds or mdworker are near the top of the list, then it could be that Spotlight has run into a problem indexing.
Keep checking Activity Monitor as you use your Mac. If mds and mdworker remain near the top of that list, you will know that they are using too many resources. The solution is to rebuild Spotlight’s index from scratch.
2. Rebuild Spotlight’s database in Terminal
- Go to Applications > Utilities and open Terminal.
- Type this string followed by Return:
sudo mdutil -E /
Spotlight will now start reindexing your Mac. Once it’s done, mds and mdworker should no longer use lots of resources.
3. What to do if mdworker quits unexpectedly
If you get an error message telling you that mdworker has quit unexpectedly, it may be that Spotlight is trying to index more than it can handle. If you have lots of external drives connected, try excluding them from Spotlight’s index to see if that helps.
- Click on the Apple menu and open System Settings.
- Choose Siri & Spotlight and then Spotlight Privacy.
- Drag external drives from the Finder into the Privacy window.
The processes mds and mdworker both run when Spotlight is indexing your Mac. They are designed not to hog system resources, but sometimes, if Spotlight runs into trouble, they can cause your Mac to slow down. To confirm that mds and mdworker are using too many resources and fix the issue, follow the steps above.