How to reindex spotlight on macOS to stop it closing after a few characters

This post is a somewhat off-topic, but for all those of you that are working on Macs, here’s a little tip to reset Spotlight when starts closing after just a few characters.

You could try going into System Preferences and adding a drive in the Privacy tab, then removing it, but it didn’t work for me (plus it seems very hacky).

Instead, do it by simply opening Terminal and typing the following command:

$ sudo mdutil -E /

This will rebuild the spotlight index database.

Done.