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

4 Answers 4

20

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

2
  • 1
    Also sudo pkill -9 mds to make sure the service is restarted is a good command to try...
    – JJarava
    Commented May 24, 2020 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). Commented Mar 8, 2021 at 18:44
9

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." Commented Jun 20, 2018 at 8:33
  • I also tried running them as root, following a sudo su. That didn't work either. Commented Jun 20, 2018 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. Commented Jun 20, 2018 at 9:37
  • I've just updated my answer with some additional troubleshooting steps. Hopefully this resolves your issue.
    – Monomeeth
    Commented Jun 20, 2018 at 22:42
  • Thanks, @Monomeeth. I did a search with the excellent Find Any File and I found 3 occurences: Commented Jun 21, 2018 at 11:43
1

I don't know whether this is better or worse, but the way I've always done it is:

  1. Go to System Prefs → Spotlight → Privacy

  2. 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.

5
  • 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! Commented Jun 20, 2018 at 9:34
  • 2
    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
    Commented Jun 20, 2018 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
    Commented Dec 5, 2018 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
    Commented Dec 5, 2018 at 13:07
  • Thanks @Tetsujin This simple method worked perfect. And feels more secure than tinkering the command line, as it is version agnostic (because is the version GUI method). CLI options suggested on post don't look bad or ultra risky, but this is totally straightforward. Your answer deserves lots of upvotes. Was hard to find because the paragraph is not extremely readable. Your proposal, IMHO, should be the first try, before CLI experiments. Do you mind if I format it just a very little bit?
    – nostromo
    Commented Nov 10 at 22:15
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. Commented Nov 25, 2020 at 17:18

You must log in to answer this question.

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