How do I rebuild the Spotlight index

  • Apple Mac Pro (early 2009)
  • Firmware 4.1 -> 5.1
  • macOS 10.13.6 beta
  • Alfred 3.6.1

Due to problems with Alfred, I am trying to rebuild my Spotlight index.
I've been advised the following commands should work:

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

sudo mdutil -E -i on /

The last command results in the error message:
Spotlight server is disabled.

Does anyone have any idea how to solve this?


I just fixed my Spotlight index issue a couple days ago with the following commands. Was driving me nuts too.

cd /
sudo mdutil -E /
sudo mdutil -a -i off
sudo rm -fr .Spotlight-V100/
sudo mdutil -i on /Volumes/Macintosh\ HD

For MacOS 10.15 Catalina and beyond, the last two lines should be:

sudo rm -fr /System/Volumes/Data/.Spotlight-V100/
sudo mdutil -i on /System/Volumes/Data

I know you tried something similar with Monomeeth guidance but maybe the subtle difference will work for you.

I added the actual Volume directory and Name to the last command since I had some USB drives plugged in that would get indexed otherwise.

I used Alfred for a while too but was happier with Quicksilver so I switched back.

Noticed you are running macOS 10.13.6 beta. Any chance that could be causing an issue? I would have put this as a comment but I don't have the rep yet. :-(


It seems you're getting the error because you're trying to turn indexing back on but the system is seeing Spotlight as disabled.

As a first step I would try the following commands in Terminal:

sudo mdutil -Ea
sudo mdutil -ai off
sudo mdutil -ai on

[UPDATE]

Since you're still getting the Spotlight server is disabled message, I would look for a hidden metadata file in the root directory.

More specifically, have a look at the directory listing for / and see if there is a hidden file labelled .metadata_never_index in the root directory. If so, delete it and try using Terminal again to enable Spotlight.