Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MacOS 10.9 - 10.13 Spotlight Reindexing Fix
# Check for root/sudo
if [ "$(id -u)" != "0" ]; then
echo "This script should not be run using sudo or as the root user"
exit 1
# Turn off indexing
echo "Turning off Spotlight indexing..."
sudo mdutil -a -i off
# Unload Spotlight
echo "Unloading Spotlight..."
launchctl unload -w /System/Library/LaunchDaemons/
# Reload Spotlight
echo "Reloading Spotlight..."
launchctl load -w /System/Library/LaunchDaemons/
# Turn on indexing
echo "Turning on Spotlight indexing..."
sudo mdutil -a -i on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment