Spotlight search can't find anything? Rebuild Spotlight Index - Using Hard Methods

I have been struggling with my Mac for a few days and it just doesn't search and find properly anymore. This manifests itself on the one hand in the Spotlight search, which I usually use to quickly find and start programs, and on the other hand in my search in Apple Mail. With a good 15 GB of mail data and up to 100 written and read mails a day, a collection quickly grows that can no longer be mastered without a search function. And that is exactly what fails in Mail, because the Spotlight index is also the basis for the mail search in Apple Mail. If you have a similar problem, the following solutions to rebuild the Spotlight Index may help.

the
Spotlight search finds nothing? You can rebuild the Spotlight index by running the macOS Port uses. Here are the step-by-step instructions!” width=”1024″ height=”484″ /> Spotlight search doesn't find anything? You can rebuild the Spotlight index using the macOS Terminal. Here is the step-by-step guide!

Spotlight search doesn't find anything

Now I have already used the "normal" way several times, with which you get Spotlight to recreate the index: You go over that Apple menu ( in the menu bar) into the System Settings, there too  Spotlight, choose the tab Privacy and there briefly adds the startup disk (in my case "Macintosh HD") and deletes it again immediately. The indexing starts again. You can also find these instructions and options for automating the process in this post: mdworker process slows down Mac - helps rebuild Spotlight index.

Apparently the Mac doesn't throw away the files it is working on, because after a few minutes of Spotlight working, the problem was back on my Apple computer. I then scoured various pages for tips and found a few that I would like to show you below. In the headline I referred to them as “hard methods” - that's because you have to penetrate macOS with the terminal.

Rebuild Spotlight Index (Easy Ways)

There are two single commands that you can use in the terminal of macOS on your Apple Mac, iMac or MacBook to rebuild the Spotlight index. The first is also used to invalidate the mds and mdworker processes and to run normally again by re-indexing the hard disk data, programs and files. After entering the data, there is of course a renewed CPU load, as the machine has to work a lot depending on the amount of data. The command to rebuild the Spotlight index for the terminal is:

sudo mdutil -E /

Another single command line is also responsible for recreating the Spotlight database. However, it also lists the processes and files indexed in the terminal. There may be pauses of one or two minutes here and there - depending on the file and size. If the command hangs completely on a file, you can locate the file and see whether it is damaged, should be deleted or other measures are necessary. The command line for the terminal is:

sudo fs_usage -f filesys mds mdworker mdworker32 | grep open

Important: The indexing process may take a few hours. To do this, you can simply leave the Mac on for a night. In the app Activity indicator you can then see whether it is through. As long as there is a process called mds_stores is high in the CPU usage, the Mac is still dodging to rebuild the Spotlight index.

Delete and recreate Spotlight index (more extensive way)

If the above methods did not solve the problems of the CPU load or the search console that could not find anything or only for a short time, you can use further system commands. These go beyond simply recreating the Spotlight index and therefore require several command lines. You can, however, simply copy these from the list below and paste them into the terminal (cmd + c and cmd + v).

First you have to deactivate the Spotlight daemon, i.e. completely switch off the Spotlight search. To do this, enter the following command in the terminal and confirm with Enter:

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

If you are asked for your administrator password, enter it. Once the command is through, Spotlight is finished. If processes are running incorrectly, you should immediately set up a relieved one CPU can recognize.

Now it is necessary to access the root directory of the system hard drive in the terminal. To do this, enter the following command followed by Enter:

cd /

Once in the root directory, the Spotlight index directory must now be deleted. To delete it, you confirm the following command in the terminal:

sudo rm -rf .Spotlight-V100

Now it's time to re-enable the Spotlight search that was disabled with the above command to rebuild the index. For this you confirm the following, last command line:

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

Since the Spotlight index is now being recreated, the procedure takes some time. Depending on the amount of space used on your hard drive, this can take a few hours. 

Last option: completely reinstall macOS

If nothing really works, you could still use the "root user" - according to some advisors and Instructions For the faulty Spotlight search, this is not only time-consuming, it also only fixes the problem temporarily. So if the solutions shown here are of no use for a faulty Spotlight search, the help you are looking for may be in a complete, "clean" reinstallation of macOS. That means, you definitely have to make a backup of your files and then have your hard drive formatted during the reinstallation. Here are a few guides:

Your Spotlight search can't find anything? But the methods shown here to rebuild the Spotlight Index could help you? Then please leave a comment on the topic :)

Did you like the article and did the instructions on the blog help you? Then I would be happy if you the blog via a Steady Membership would support.

25 Responses to “Spotlight search finds nothing? Rebuild Spotlight Index - Using Hard Methods"

  1. Hallo,
    I have the process sudo fs_usage -f filesys mds mdworker32 | grep open <and it's been running for 48 hours. (MBPro 15 "mid 2012, i7 2,6Ghz, High Sierra 10.13.6).
    I have the terminal open.
    How can I tell that the process is complete?
    If I now want to close the terminal, does the message appear that I will then abort the process?
    But I think that after 48 hours my hard drive (1 TB SSD occupied by 650 GB) was completely re-indexed, in any case the search in Mail works again.
    Would be nice to get an answer.

    PS:
    however, the mds and mdworker processes used very little processor power.
    In the past, however, this was sometimes a decent load and the temp went up and the fans started.

    Thanks for the hint.

    Kind regards Manfred

    1. Hello Manfred! I'm not the king of terminals, but actually the mdworker process starts by itself when Spotlight tries to index. Presumably it always runs in the background and only needs more resources every now and then. I had that for a while, too the process “mdworker” really slowed down my MacBook Pro. Behind the link is the corresponding article. ;-) But that hasn't happened since Mojave and my new MacBook Pro 2017. Either the new hardware pays off or Mojave has it better under control with the mds and mdworker.

      Regarding your questions: If you close the terminal window, only your triggered process will surely be stopped. An independent process from the macOS itself is probably still running in the background. I just looked in the "Activity Monitor" tool and there were several at work, but all without any significant CPU utilization... all at 0% utilization.

  2. I tried the "more extensive way" but unfortunately I get the message "no such file or directory" on the cd/ command. Am I doing something wrong?

    1. Hi Michael! No sorry. The fault was mine. The command must be “cd /”. The space was missing. Then it should work for you. I corrected it in the instructions above. Thank you for your hint!

  3. Second attempt with the more extensive route: The individual steps in the terminal went very quickly (in what felt like a hundredth of a second). And after a few minutes of waiting, the search in Mail actually works again. Thank you for the solution!

  4. Stephen Weiss

    Hello Sir! I have a strange question. Windows 10 is installed on my Mac with Parallels, which works like a normal system, i.e. fast, stable and without problems for a long time. I also have a PC, hardware parameters like Mac and the Windows works like a Windows, ie with a lot of annoying problems and much slower, unstable. When it comes to updates, I only have problems with the PC, although everything has been done to be a little better. I did a lot of research but couldn't find an answer for this huge difference. For example: a cumulative update for Mac 70 sec. , at the same time on PC for more than 12 minutes. Do you have an explanation? Thanks. Stefan Weiss

    1. Hello Stefan! Well, I would say the Mac is simply better! :D No, that might be too easy. I don't know the hardware specs of the Mac and PC, but it could be that the Mac has a fusion drive, which dramatically speeds up the hard drive. If the PC does not have something (SSD), then this point alone could make a big difference. But the funny thing is that we have had the same experiences. I once had a “real” PC and it always caused problems. Since my Windows has been running on the Mac, there has hardly been any trouble. I assume that this is also due to the fact that the hardware components are known on the Mac and Parallels Desktop knows “exactly” which drivers etc are required. But I can't say for sure. VG! Jens

  5. Dear Sir Apfelot,

    I think my Mac also suffers from the phenomenon described.
    So I've just tried to go the more extensive way (after the first command actually didn't change anything) - but this command probably won't get through because the Mac says: Operation not permitted while System Integrity Protection is engaged

    What do I do now please ???

    Thank you very much for your help!
    Best Regards
    Andrea

    1. Hello Andrea! This is due to the SIP of macOS. You can turn this off by starting the Mac in recovery mode (hold down CMD + R while restarting). Then go to Terminal in the Utilities menu and enter this command: csrutil disable
      Then the Mac has to be restarted and now SIP should be switched off. If you want to turn it on again, you can do this with the command csrutil enable
      I would recommend not leaving it turned off permanently as it is some degree of protection against malware.

  6. Hello Sire,
    Initial problem:
    I couldn't reliably find all files by name or mails by subject in either mail or Finder when I searched for . (It was probably much more dramatic with the content, but I didn't actively observe that, I noticed that more in the background that that doesn't work well either) Alright, I've used the command "sudo fs_usage -f filesys mds mdworker mdworker32 | grep open” in Terminal and checked the activity monitor to see what was going on: Started at 09:20. At the beginning high utilization with mds_stores, the rows were added quickly until 12:25. Since then, hardly anything has gone on, mds_stores no longer needs CPU time, statistics tell me 3:33:50 CPU time has been taken up by mds stores. Now the activity monitor tells me that 95% is idle. I just started Filemaker to see if Terminal sees it - it does. but with the indexing everything seems to be there. If I go to the finder, it now finds 0 files, even if they exist and can be seen.

    WHAT CAN I DO? Before I get into out-of-round emotions, I very much hope for a relieving hint!
    Thanks in advance
    Andreas

    1. Hi Andreas! Have you ever tried to copy the startup volume 1: 1 to an external hard drive with Carbon Copy Cloner or Super Duper and then re-create the index there when you start from the external hard drive? That ultimately helped me. I think some file was corrupted and made indexing unusable over and over again. Cloning the hard drive then probably skipped this file and allowed the Mac to index normally again.

  7. Hi Jens,

    I've arranged for a new hard drive to come and then I'll try. Until then, I'll keep my hope up.
    If I got it right:
    1. Copy to the new external disk with CarbonCopy.
    2. Boot from the external disk
    3. Create an index - via System Settings -> Spotlight, the standard method, or again via Terminal?
    I hope the hard drive will be delivered soon, under current conditions a bit more difficult than usual to get it.
    In any case, thank you that I am not yet deprived of all hope with your advice.

    1. Hi Andreas! Yeah, just like you wrote. If Spotlight runs clean on the external hard drive again, you can empty the internal hard drive and clone everything from the external to the internal with CarbonCopyCloner. In the future you will start again from the internal disk.

      1. Hello Jens,
        I copied to the external drive and I managed to start the computer from the external drive.
        I went to the System Settings -> Spotlight, moved the entire external hard disk into it in privacy, closed the system settings, waited a little, opened it again, removed the external hard disk from the list and made the system settings again.
        now I have to wait, because until now spotlight is still finding as much as before, namely nothing. in the terminal you don't see anything going on either.
        Am I still on the right track? Do i just need patience? Until tomorrow?
        I hope so
        with good wishes for a nice evening
        Andreas

        1. Hi Andreas! So basically you did everything right. The complete indexing may take a few hours, but I got results from Apple Mail after a few seconds. Or, for example, it should also find programs directly. If it doesn't, we haven't resolved the problem yet. But right now I don't know what else we could do. Maybe create a new user and see if Spotlight runs properly under this user?

  8. Hey Jens
    Thank you for your work.
    I would like to try it, because spotlight-suche keeps getting “broken” for me.
    In and out of privacy helped once, unfortunately only for a short time.
    Meanwhile, there is an unknown error in the attempt.
    And when I try “sudo launchctl unload -w…” I get the message that the operation is not permitted as long as System Integrity Protection is on (/System/Library/LaunchDaemons/com.apple.metadata.mds.plist: Operation not permitted while System Integrity Protection is engaged).
    Is the area always protected by SIP? Then the way would not work for others either. Or what can be wrong here? I would reluctantly try to turn off SIP.
    Do you have any idea?
    Regards, Tim

    1. Hello Tim! The short answer is yes, unless you decide to turn off SIP for a short period of time, you cannot make any changes to this part of the system. But it's hard for me to say where the problem is that your spotlight keeps breaking. I had the same problem but I have no idea why it eventually went away again. Maybe it has something to do with iCloud too...I don't know. :(

      1. Thank you.
        Did that mean that all who report changes here have switched off the SIP beforehand?
        I was just swayed by the many warnings that say "don't do that, never"...

        1. Hello Tim! So in older macOS systems this was still possible without switching off the SIP. But Apple has gradually isolated the system more and more and therefore you have to do it now. It's a security hole, of course, but if you don't install anything wild during the time (where it's disabled) nothing should happen.

  9. Hi Jens,

    does the index rebuild include external hard drives?

    I have the problem that not all files are found in the finder for some time even though they are there. Find any File helps me a lot and finds everything, but this is not a permanent solution because the finder no longer works properly.

    Since I hardly have anything on the internal system hard drive and only use external HDDs for my work, I don't know how to adapt the terminal commands. I have no idea about the terminal per se = I can only paste and execute what you wrote in your blog.

    I only have problems with the finder search. I never use Spotlight itself. Mail search works too.

    Thank you very much

    Pete :)

    1. Hi Peter! It depends on whether or not the hard drive is excluded from Spotlight in the privacy settings. If not, then this will also be included in the new index. I believe both Spotlight and Finder use the same index. Therefore, the commands should also help you. I hope it helps!

Post a comment

Your e-mail address will not be published. Required fields are marked with * marked

In the Sir Apfelot Blog you will find advice, instructions and reviews on Apple products such as the iPhone, iPad, Apple Watch, AirPods, iMac, Mac Pro, Mac Mini and Mac Studio.