Reenable Spotlight
I noticed that spotlight was using a lot of CPU and I did not have time to debug it, so I disabled spotlight with this command:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
Now I want to reenable spotlight and debug why it is non-stop indexing my drive, but I can't figure out how to reenable it.
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
/System/Library/LaunchDaemons/com.apple.metadata.mds.plist: service already loaded
But when I search for anything I get "No Results".
Here is my configuration:
How do I get indexing reenable?
[EDIT]
I tried one of the suggested answers with this result:
% sudo mdutil -a -i off
Password:
/:
2020-09-03 15:35:44.980 mdutil[33360:1381738] mdutil disabling Spotlight: / -> kMDConfigSearchLevelFSSearchOnly
Indexing disabled.
/System/Volumes/Data:
2020-09-03 15:35:45.026 mdutil[33360:1381738] mdutil disabling Spotlight: /System/Volumes/Data -> kMDConfigSearchLevelFSSearchOnly
Indexing disabled.
/Volumes/MBP15 Time Machine:
2020-09-03 15:35:45.060 mdutil[33360:1381738] mdutil disabling Spotlight: /Volumes/MBP15 Time Machine -> kMDConfigSearchLevelFSSearchOnly
Indexing enabled. (Indexing level may not be changed on volumes which have a Time Machine backup)
/Volumes/MBP15 Time Machine/Backups.backupdb:
2020-09-03 15:35:49.728 mdutil[33360:1381738] mdutil disabling Spotlight: /Volumes/MBP15 Time Machine/Backups.backupdb -> kMDConfigSearchLevelFSSearchOnly
Indexing enabled.
% sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
/System/Library/LaunchDaemons/com.apple.metadata.mds.plist: Operation not permitted while System Integrity Protection is engaged
% sudo mdutil -a -i on
/:
Indexing enabled.
/System/Volumes/Data:
Indexing enabled.
/Volumes/MBP15 Time Machine:
Indexing enabled.
/Volumes/MBP15 Time Machine/Backups.backupdb:
Indexing enabled.
Open Terminal window from LaunchPad.
First, turn off Spotlight:
sudo mdutil -a -i off
Next, unload the metadata file that controls Spotlight’s index:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
Use the following command to re-loads the index :
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
As a last step, turn Spotlight back on:
sudo mdutil -a -i on
After a few minutes to rebuild the index, Spotlight should be functioning as normal.