Mdworker and high CPU usage
Ever since last year when I upgraded to Mac OS X Lion I had noticed that a process called “mdworker” was constantly eating up about 80-100% of my CPU. After some googling I learned that mdworker is part of spotlight’s indexing service and that others have experienced the same issue as me. Unfortunately it appeared that no one has found a solution; the only way to stop mdworker is to disable spotlight. I use spotlight on a daily basis to launch all my apps using Command key+space bar, so disabling spotlight was not something I wanted to do. So I toughed it out, getting even more frustrated as every day my MacBook Pro would randomly grind to a halt as mdworker chugged away, gobbling up as much CPU as possible.
Then, when Apple released Mountain Lion I hope and prayed that this issue would be resolved, but, to my dismay the problem was still there. Suddenly, I remembered the Mac OS X Console.app; Console allows you to view logs of all the events, services, and processes your Mac is doing and it will tell you of any errors. Sure enough there were many listings for mdworker, such as this one:
"2012-08-26 2:14:29.282 PM mdworker: (Normal) Import: pre-ls-info uti:dyn.ah62d4qmuhk2x43xtr34hq2pzrv4a plugin:internalPlainTextImporter exceeded cpu use limits (12) after 40216 milliseconds - find suspect file using: sudo mdutil -t 371363"
Most of that means nothing to me but I found it comforting that my Mac and I agreed that mdworker has been exceeding CPU usage limits. Then I noticed “find suspect file using: sudo mdutil -t 371363” Perhaps mdworker is stuck on a file and this is the cause of my frustration? So I opened terminal and typed the command “sudo mdutil -t 371363” (no quotes) and sure enough the culprit was Suitcase Fusion.fontvault! I checked all the other logs for mdworker and it told me the same thing; spotlight was having a hell of a time indexing my Suitcase Fusion font vault.
Exclude the Suitcase Fusion’s font vault folder from Spotlight’s indexing. I keep my font vault database in a folder within my Documents folder, but the default location is /Library/Extensis/Suitcase Fusion/Suitcase Fusion.fontvault. In Lion/Mountain Lion the Library folder is unnecessarily hidden so first you will need to make it visible.
- Open Terminal.app and type:
chflags nohidden /Users/USERNAME/Library
replace USERNAME with your user name.
- Open System Preferences > Spotlight, then under the Privacy tab add /Library/Extensis/Suitcase Fusion/ to the exclude list
After making this change mdworker quieted down and returned to normal operations and my MBP has been runny happily. What a relief!