Re-Index Spotlight from the Terminal, Re-Gain Valuable Time for Life [OS X Tips]



Last week, we showed you how to make Spotlight work faster with a little reindexing trick in System Preferences. Today, we’ll do the same thing, only we’ll use some Terminal magic to make it happen.

As we mentioned then, sometimes the indexing database that Spotlight uses to keep track of where your files are gets corrupted, misplaced, or left on an old hard drive somewhere. Whatever the reason, though, we’re assuming you need to manually re-update. Here’s how.

Launch Terminal, and type or paste the following command:

sudo mdutil -E /

This basically asks for temporary super user status, which is why Terminal may ask you for your password (it may not if you’ve used a sudo command recently or are already logged in as a super user or root. The command asks the unix tool mdutil to reindex the spotlight database for everything on the computer, including external drives, mounted disk images, etc. To re-index only for a specific drive, use the /Volumes path. For example, for an external drive named “MiniMe,” the command would look like this:

sudo mdutil -E /Volumes/MiniMe/

Spotlight will begin to re-index on the spot, so things might get a bit slower, especially if you are using an older Mac and re-indexing the entire filesystem.

[Source:OS X Daily]
[image source: HD Wallpaper]