Skip to content

Instantly share code, notes, and snippets.

@anjerodesu
Created December 27, 2012 03:27
Show Gist options
  • Save anjerodesu/4385230 to your computer and use it in GitHub Desktop.
Save anjerodesu/4385230 to your computer and use it in GitHub Desktop.
This is a Spotlight reindexing script for Mac. If you have problems such as your Mac is always indexing your HDDs or the indexing process always crashes.
#!/bin/bash
# This is a Spotlight reindexing script for Mac.
# If you have problems such as your Mac is always indexing your HDDs
# or the indexing process always crashes.
# turn off all mounted volumes
# remove -a to apply only on current volume
# -a : apply command to all volumes
sudo mdutil -a -i off
# remove all indexed files
sudo rm -rfv /.Spotlight-V100
# turn the spotlight back on with all mounted volumes
sudo mdutil -a -i on
# reindex all mounted volumes
sudo mdutil -aE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment