4

My spotlight searching hasn't worked for quite some time and I've tried everything I could find on Google. I can't search for anything on my MacBook.. literally nothing shows up. I'll list the things I've tried and specs:

Early 2011 2.2Ghz MBP 4GB RAM OSX 10.9.4

  • disble/enable spotlight via terminal
  • toggled hidden files and looked for ".metadataneverindex" couldn't find it
  • repeated the previous, using terminal commands.. file not found
  • put everything in the preferences/privacy "prevent indexing" then removed
  • sudo mdutil -i on /

  • sudo mdutil -E /
  • sudo mdutil -a -i on
  • zapping the PRAM

Based on what Trane Francks said in the comment below.. I built the DB and ran the line again. The second line is what it returned: locate .metadata_never_index /.metadata_never_index

I found .metadata_never_index as a hidden file in my root, so I deleted it and tried reindexing.. but its giving the "Indexing and searching are disabled" message still.

I've tried many of things and every time.. I get "indexing and searching disabled."

I just wanna be able to search my mac again!! Please help! Thanks.

5
  • 1
    Just to confirm, the filename is actually '.metadata_never_index'. When I run 'locate .metadata_never_index' in Terminal, it finds the file in my recovery partition. – Trane Francks Sep 23 '14 at 7:55
  • I tried that and terminal returns: "WARNING: The locate database (/var/db/locate.database) does not exist. To create the database, run the following command: sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist" – Justin Oct 1 '14 at 0:31
  • @TraneFrancks I updated my question after I updated the database and tried it again. Can I do "rm /.metadata_never_index" to delete it? – Justin Oct 1 '14 at 0:41
  • 1
    If you want to delete a system file, you'll need to use sudo, e.g., sudo rm /.metadata_never_index. – Trane Francks Oct 1 '14 at 1:13
  • I wonder if this is much different than apple.stackexchange.com/questions/24401/… – bmike Mar 16 '16 at 13:35
16

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!

4

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
1
  • It gives the "indexing and searching disabled." message when I try that – Justin Oct 1 '14 at 0:30
3

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!

:)

1
  • Thank you for this! Did you also run some random script you found on Github? :p – scorgn Nov 10 '20 at 1:39
1

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

New contributor
ramene is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
3
  • How is this answer any different than the info already provided in the other answers? – fsb 2 days ago
  • @fsb I updated my answer as others mileage may vary. I'm not disputing the accepted answer, I'm simply chiming in with the approach that worked for me. – ramene 2 days ago
  • Thanks for updating. When I read your answer originally, it contained the same info already provided so I didn't see what was different about it. – fsb 2 days ago

You must log in to answer this question.

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