Sep 02 2015 0

High CPU usage for mds process

Lately the Mac Mini was getting somewhat slow again. Looking at the Activity Monitor showed the process mds to take up 90-100% CPU for one of its cores. The mds process is one of the processes related to the Spotlight feature of OSX.

Activity Monitor - High CPU usageActivity Monitor - High CPU usage

A quick Google search learned that I am not the only one running into this or similar issues. The following two looked the most promising

  • Method 1 - This topic on StackExchange contained a couple of useful commands to resolve the issue.
  • Method 2 - Another option might the steps detailed here.

In my case the first method did not resolve it. The second method did.

Activity Monitor - Normal CPU usageActivity Monitor - Normal CPU usage

Method 1

Turn indexing off

amun:~ administrator$ sudo mdutil -a -i off
/:
2015-08-31 13:29:07.866 mdutil[91354:11799072] mdutil disabling Spotlight: / -> kMDConfigSearchLevelFSSearchOnly
    Indexing disabled.
/Groups:
2015-08-31 13:29:08.378 mdutil[91354:11799072] mdutil disabling Spotlight: /Groups -> kMDConfigSearchLevelFSSearchOnly
    Indexing disabled.
/Shared Items/Public:
2015-08-31 13:29:08.560 mdutil[91354:11799072] mdutil disabling Spotlight: /Shared Items/Public -> kMDConfigSearchLevelFSSearchOnly
    Indexing disabled.
/Users:
2015-08-31 13:29:08.685 mdutil[91354:11799072] mdutil disabling Spotlight: /Users -> kMDConfigSearchLevelFSSearchOnly
    Indexing disabled.
/Volumes/Macintosh HD2:
2015-08-31 13:29:08.906 mdutil[91354:11799072] mdutil disabling Spotlight: /Volumes/Macintosh HD2 -> kMDConfigSearchLevelFSSearchOnly
    Indexing disabled.
/Volumes/Macintosh HD2/shared:
2015-08-31 13:29:09.575 mdutil[91354:11799072] mdutil disabling Spotlight: /Volumes/Macintosh HD2/shared -> kMDConfigSearchLevelFSSearchOnly
    Indexing disabled.
/Volumes/Macintosh HD2/websites:
2015-08-31 13:29:09.667 mdutil[91354:11799072] mdutil disabling Spotlight: /Volumes/Macintosh HD2/websites -> kMDConfigSearchLevelFSSearchOnly
    Indexing disabled.
/Volumes/Time Machine Backups:
2015-08-31 13:29:09.760 mdutil[91354:11799072] mdutil disabling Spotlight: /Volumes/Time Machine Backups -> kMDConfigSearchLevelFSSearchOnly
    Indexing and searching disabled.
/Volumes/Time Machine Backups/Backups.backupdb:
2015-08-31 13:29:17.499 mdutil[91354:11799072] mdutil disabling Spotlight: /Volumes/Time Machine Backups/Backups.backupdb -> kMDConfigSearchLevelFSSearchOnly
    Indexing enabled.

Turn indexing back on

amun:~ administrator$ sudo mdutil -a -i on
/:
    Indexing enabled.
/Groups:
    Indexing enabled.
/Shared Items/Public:
    Indexing enabled.
/Users:
    Indexing enabled.
/Volumes/Macintosh HD2:
    Indexing enabled.
/Volumes/Macintosh HD2/shared:
    Indexing enabled.
/Volumes/Macintosh HD2/websites:
    Indexing enabled.
/Volumes/Time Machine Backups:
    Indexing and searching disabled.
/Volumes/Time Machine Backups/Backups.backupdb:
    Indexing enabled.

Re-index Spotlight by wiping the old index data

sudo rm -rf /.Spotlight-V100/*

This will force the index for Spotlight to be rebuilt, i.e. depending on the amount of data on your disks your machine will be running at high CPU for quite some time. When it is done things should settle back to normal.

Method 1

Stop Spotlight

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Start Spotlight

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Previous post
Simple web server Sometimes you just need a simple web server to quickly test a piece of HTML or CSS before uploading it to its final location. Both Python and PHP
Next post
Social Sharing Buttons Recently I updated the layout for my blog to include some buttons at the end of each post so readers can easily share it to some social
This blog is powered by Blot