7
  • 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?

13

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. :-(

3
  • Thanks for the reply, but here is the result... Jun 25 '18 at 19:47
  • Also sudo pkill -9 mds to make sure the service is restarted is a good command to try...
    – JJarava
    May 24 '20 at 17:22
  • 1
    Thank you for this, the standard Apple solution of adding to privacy and then removing did not work and my Spotlight was barely usable. Your mdutil commands finally fixed it (after accounting for user partition in Catalina by using /System/Volumes/Data and then waiting ~1 hour). Mar 8 at 18:44
5

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.

9
  • I typed in each of these commands. The response for each one was: "Spotlight server is disabled." Jun 20 '18 at 8:33
  • I also tried running them as root, following a sudo su. That didn't work either. Jun 20 '18 at 8:38
  • I've also tried deleting the /.Spotlight-V100 folder. When I carry out the mdutil commands, I see that this folder is recreated albeit with very small files inside. Jun 20 '18 at 9:37
  • I've just updated my answer with some additional troubleshooting steps. Hopefully this resolves your issue.
    – Monomeeth
    Jun 20 '18 at 22:42
  • Thanks, @Monomeeth. I did a search with the excellent Find Any File and I found 3 occurences: Jun 21 '18 at 11:43
0

I don't know whether this is better or worse, but the way I've always done it is
System Prefs > Spotlight > Privacy

Drop any/all volumes in there, wait a minute, remove them again.
You can check Spotlight is rebuilding by launching it & trying a test search.
You can also see mdworker going nuts for a while, in Activity Monitor.

4
  • 4
    When I try to add a folder to the Privacy list I get the error: "Privacy List Error. The item couldn’t be added or removed because of an unknown error." which is less than helpful. Thanks, Apple! Jun 20 '18 at 9:34
  • 1
    I've recently had so much trouble with Time Machine local snapshots clogging up my APFS SSD that I've had to clone to HFS, nuke & clone back to get rid of the mess... Hope you're not suffering anything similar :/
    – Tetsujin
    Jun 20 '18 at 9:38
  • @Tetsujin, are you storing your Time Machine snapshots/backups to your main startup disk (i.e. /dev/disk0 / Macintosh HD)? Or do you have an additional APFS SSD?
    – voices
    Dec 5 '18 at 13:04
  • @tjt263 - yes, it's simply set to defaults in that regard. However, since I updated to Mojave at the first beta, I have had no issues with it at all. High Sierra was a total nightmare; Mojave has fixed just about every issue I ever had with the 2 Sierras.
    – Tetsujin
    Dec 5 '18 at 13:07
0

I tried @joecap5's suggestion but this is what I got...

enter image description here

1
  • Make sure that your Macintosh HD is not listed on the Privacy tab or re-enabling will not work. Nov 25 '20 at 17:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .