How to Fix "mds" Process Stuck at 100% CPU Usage
I should specify that the Alfred extension runs "sudo" commands, so you must have Terminal open and signed in for this to work. You probably don't have to do this too often, so pasting the commands into Terminal will work fine.
Is your computer running a little sluggishly? Have you opened Activity Monitor on your Mac and seen a process called "mds" taking up 100% of your CPU power and show no sign of stopping? A quick Google search shows this is a pretty common problem on OS X, and it's one that I ran into myself recently.
I don't know what "mds" stands for, but it is a process of Spotlight that indexes your hard drive. Spotlight is a great tool, so you definitely want this, but sometimes it gets stuck and can't do its job right. If your "mds" process has been going at full force for over an hour, then it's probably never going to sort itself out and you're going to have to step in.
After much research and trial and error, I came across 2 simple terminal commands that will restart Spotlight and get you back in good shape. First, copy this into Termainal to stop Spotlight:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
Next, run this to restart Spotlight:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
And that should do it. It will force Spotlight to stop indexing and when it restarts, it should go back to normal.
Alternatively, if you don't like to mess around with the command line, I made this Alfred workflow called KillSpot that does it for you. Download the workflow here.
I hope that helps!
Props to Tequila Fish for providing the terminal commands.