Indexing files and folders (directories) of storage devices is good and bad at the same time. Spotlight always indexes your macintosh storage, so you can type any program to execute it or a file name to search for it. But indexing external storage volumes is consuming too much horsepower and time of your mac computer.

To make your pendrive and external harddisk plug-and-play, we are going to disable spotlight indexing for external storage volumes on your mac machine.

Disable Spotlight indexing for external storage drives / volumes

First let’s open Terminal application, then type this command and click ENTER (Return) key on your keyboard.

sudo mdutil -a -i off

That command disabled the indexing for all storage devices connected to your mac (which appear in /Volumes/ directory). But we need Spotlight to index the main storage of mac computer to be able to type the program name to execute it easily!!

So we let Spotlight to index the main storage unit - which contains the applications and the mac os x system - using this command.

sudo mdutil -i on /Volumes/mac-name

note : make sure to replace mac-name with your main storage name in the /Volumes/ directory.

Those commands work for HDD and SSD, don’t worry. It is a software thing.

How to stop Spotlight from indexing a specific external storage drive

The steps to are so simple. Just open Terminal at the root folder / directory of the external storage drive (pendrive, HDD or SSD) by right clicking and choosing New Terminal at Folder. Then type this command and click ENTER (Return).

touch .metadata_never_index

That command tells mac os not to index that directory tree (storage drive). You are done!

Do you recommend reading this blog post? share it!