How to force spotlight to reindex your drive

This command will force spotlight to reindex your drive. It is useful if your spotlight index isnt returning results you know it should. This post will help you force spotlight to reindex either your whole machine, or a specific folder.

force spotlight to reindex your drive using the terminal

open applications > terminal:

sudo mdutil -E /

You can force spotlight to reindex specific folders if you only want the results updated from a single location (eg your documents folder)

sudo mdutil -E /path/to/folder

You can view a full list of flags available in mdutil with the command

man mdutil

Here is a copy of the flags from mdutil:

    The mdutil command is useful for managing the metadata stores for mounted volumes.

     The following options are available:

     -p  Spotlight caches indexes of some network devices locally.  This option requests that a local caches
         be flushed to the appropriate network device.
     -E  This flag will cause each local store for the volumes indicated to be erased.  The stores will be
         rebuilt if appropriate.
     -i on | off
         Sets the indexing status for the provided volumes to on or off.  Note that indexing may be delayed
         due to low disk space or other conditions.
     -d  Disables Spotlight searches on the provided volume.
     -s  Display the indexing status of the listed volumes.
     -a  Apply command to all volumes.
     -v  Print verbose information when available.

force spotlight to reindex your drive using the gui

There is a second method for this, as outlined in the apple support guide

  • Goto preferences > spotlight > privacy
  • Drag a folder, or a whole hard-drive into the ignore list
  • Click ‘ok’ if you are prompted
  • Highlight the folder or drive you just added
  • Click the minus button ( – ) to remove the drive or folder you just added
  • This will remove the drive or folder from the ignore list
  • Spotlight will now re-index

Leave a Reply