Spotlight "Indexing and searching disabled." message in terminal on OSX. Why?

FINALLY!! I got it working again!

Heres what I did:

In terminal I ran:

locate .metadata_never_index

No database existed, so it prompted me to run:

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

It ran for a few seconds and I retried the locate command.. it found it in my root. I deleted it and tried turning on spotlight again, but still got the "indexing and searching disabled."

I checked the permissions of my SSD and my account wasn't even listed. I added myself to read/write. Then ran:

sudo mdutil -i on /

terminal returned "Indexing enabled."

Lastly.. I went to system preferences>spotlight>privacy.. dragged my SSD then removed it to reindex. 40 minutes later.. everything is back to normal! It had been a year since spotlight worked on my MBP. Ohhh the struggles I faced trying to find emails/files.

Thanks for the tips and suggestions everyone and Google!


I search for it in the net for months... and it was so easy!!

System preferences -spotilight -Privacy -if your harddisk is in the list mark it and then press (-)

When your harddisk is removed from "prevent searching this locations", you spotilight will scan your files for around 2 hours and voila!

:)


Re-index an entire drive In the Terminal, type sudo mdutil -E / and hit return. You may have to enter your password. The existing Spotlight index will be deleted, and Spotlight will start creating a new index in the background. You can re-index other hard drives by changing the command to include their name, like sudo mdutil -E /Volumes/OtherHardDrive.

sudo mdutil -i off /
sudo rm -rf /.Spotlight*
sudo mdutil -i on /
sudo mdutil -E /

I'm order, these accomplish:

  1. turn indexing off
  2. delete Spotlight folder
  3. turn indexing on
  4. rebuild

I just recently ran into this issue with needing to reindex my external drive in order for Spotlight and/or HoudahSpot to search files accordingly., albeit, I'm still not pulling back archives i.e., .rar, .zip, .gzip

For me, running:

sudo mdutil -a -i on

Automatically enabled and re-indexed all drives.

When I attempted to enable indexing on an external drive explicitly, I see the following:

sudo mdutil -E /Volumes/EXTERNAL_DRIVE
/Volumes/EXTERNAL_DRIVE:
2021-02-25 10:26:51.123 mdutil[5421:1461549] mdutil disabling Spotlight: /Volumes/EXTERNAL_DRIVE -> kMDConfigSearchLevelFSSearchOnly
    Indexing disabled.

Only after running sudo mdutil -a -i on was I then able to find (/var/db/locate.database) after re-indexing completed as the accepted answer suggests.

For some reason, sudo mdutil -E /Volumes/EXTERNAL_DRIVE, which should erase and rebuild the index doesn't work as expected.

HTH