X

Spotlight plug-ins may cause high CPU usage by 'mdworker'

When the "mdworker" process uses a lot of CPU in OS X, one possible cause might be faults in Spotlight plug-ins.

Topher Kessler MacFixIt Editor
Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.
Topher Kessler
2 min read

One issue that people may experience in OS X is when the process "mdworker" takes up an inordinate amount of CPU resources and results in a slow and laggy computer. The mdworker process is a file-indexing tool that is invoked either when drives are mounted or when files on locally mounted drives are altered. The resulting index is then used by Spotlight and other searching utilities to quickly reveal files instead of having to scan file-by-file, which can take an exceptionally long time, especially as people increasingly use larger hard-drive and filesystem capacities.

Being invoked by filesystem changes, when a process changes a file on disk, the mdworker process may be activated to index the changes. For the most part mdworker will index all files in the same way, but to enhance support for specific file types, developers can alter the indexing methods by supplying Spotlight with a plug-in that will govern what metadata the mdworker tool tries to index.

Spotlight Plug-ins folder
Faulty plug-ins for Spotlight may cause slow indexing. Try temporarily removing them from this folder to see if they are contributing to the slowdowns.

If indexing starts taking a long time, one possibility may be an error with any of the Spotlight plug-ins that are on the system. After installing suites like Microsoft Office, iWork, iLife, and some Spotlight-enhancing utilities, you may end up with a number of Spotlight plug-ins that all adjust how Spotlight will handle the indexing of files.

To troubleshoot the plug-ins, go to the /Macintosh HD/Library/Spotlight/ folder and move all the .mdimporter files from this folder to another location (one option is to put them in a subfolder named "disabled plug-ins"), and then restart the system. After this, add the plug-ins back one at a time, and keep Activity Monitor open to check whether the mdworker process takes up a lot of CPU. This may take some time, but it will allow you to isolate which ones could be causing the problem. Some people have specificially mentioned the "Microsoft Office.mdimporter" plug-in that comes with Office as being a root of this issue, but others may also cause problems.

Other options
Though the problem may be with mdimporter plug-ins, another option you can try is to rebuild the Spotlight index from scratch, either with the plug-ins installed or with them disabled. There are several ways to do this, including using a cleaning utility like OnyX, which supports removing the spotlight indexes from the system, and another way is to add each locally mounted hard drive to the "Privacy" list in the Spotlight system preferences. After doing this, restart the system for safe measure (this should not be necessary, but will not hurt anything), and then remove the drives from the privacy list and Spotlight should re-index them.



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.