mdworker and mds OSX problems solved - speed up your Mac

Spotlight on Spotlight problems, especially mdworker and mds process

When your Mac is running very slowly and there is no obvious cause, the problem could be because of mdworker and mds processes in OS X. Here is the solution you need to reclaim your Mac’s speed.

This is a worked example of the sort of thing than can go wrong with your Mac and how to solve the problem. An hour ago My Mac stopped working, but now it is back to normal. Want to know how I did it? read on. (Affiliate links in this article.)

The problem was that the Mac was running slowly. It wasn’t bad, but it was a bit annoying watching the spinning beach ball where the mouse should be.

Then it almost stopped completely. The Mac was barely usable and switching from one window to another took 30 seconds. Click a menu and it would not appear until 20 seconds later. Click a button and nothing would happen for 20 or 30 seconds. It was like swimming through through treacle.

It was almost, but not quite impossible to use the Mac. It just took forever to do anything, no matter how simple. When this happens, you need to run Activity Monitor in the Applications/Utilities folder.

It took some time to quit a few apps, close a couple of windows, and get Activity Monitor open because the Mac had almost stopped responding, but eventually it opened.

Issues with mdworker and mds process

The problem could be seen on the Memory tab and mdworker was using 2.23 GB of memory, 1.72 GB of swap file was used, there was 2.33 GB of compressed memory, and the memory pressure chart was completely red.

A red memory pressure chart means there is no memory left to do anything and the Mac gets really bogged down swapping memory out to disk, compressing it, and juggling it around.

The mdworker process is used by Spotlight and _spotlight can be seen in in the User column in Activity Monitor. In addition to the 2.23 GB at the top, further down were several more mdworker processes using 37 - 45 MB. Also there are mds processes that are also related to mdworker and these were also using memory.

mdworker process in OS X using too much memory and CPU

It was all way too much for a 4 GB MacBook Pro.

The problem may have been exacerbated by plugging in two USB disks and a USB flash memory stick. Spotlight just went crazy trying to index everything and the Mac ground to a halt.

Related: Best tips and tricks for Spotlight searches in OS X

Stop Spotlight

The solution, although not a perfect one, is to turn off Spotlight because Spotlight runs the mdworker process to index the contents of disk drives.

Go to System Preferences and open Spotlight. Select the Privacy tab. Click the plus button at the bottom and add each of your disk drives and partitions.

Add disks and partitions to the Privacy tab in Spotlight preferences in OS X

This tells Spotlight not to index any of the disk drives or partitions. It causes mdworker to stop what it is doing and to discard any indexing that was taking place and the index it had already created.

Check Activity Monitor

Now mdworker is no longer using the huge amount of memory it required previously. There an mds process, but that’s only 61.5 MB. The memory pressure chart has turned green indicating that there are no longer any memory problems, the swap file and compressed memory usage is a fraction of what it was.

Use Activity Monitor in OS X to check that everything is running OK

Adding all the disks to the Privacy tab does not stop Spotlight completely because there are many different components, including web searches, dictionary definitions and so on. What you won’t see are any files or apps in the search results. When Spotlight indexing is stopped, you can’t search for files. Open Finder and if it is set to show all your files by default, it will be empty. It seems that the results come from Spotlight, which is disabled.

Now that the Spotlight file index no longer exists, you may find that removing the disks, or at least the internal boot disk, from the Privacy tab in Spotlight System Preferences causes mdworker to act normally again.

Spotlight will index the disk contents once again and rebuild a brand new index. This will impact performance of the Mac a bit, but it should never be so bad you can’t use it, as was the case with my MacBook. When Spotlight has finished indexing the disk, mdworker will quieten down and Spotlight searches will work again.

Alternatively, you could leave Spotlight disabled with all the disks on the privacy tab and use some other search tool.

 

Share

Add new comment

By submitting this form, you accept the Mollom privacy policy.

Related items you will like...