Include external drive in Spotlight search

I have a large external drive, that contains several hundred thousand photos connected to my Mac Studio, running MacOS 12.6 I’ve just noticed that Spotlight isn’t indexing it. When I look in System Preferences → Spotlight → Privacy, the drive in question is not listed, so there’s no reason that it shouldn’t be indexing.

How can I enable Spotlight searching for this drive? (I’ve searched the internet, and not come up with a solution.)

launch Terminal.app
from man tmutil
# tmutil removeexclusion [-pv] item ...
Configure Time Machine to back up a file, directory, or volume during future backups.

Many things can cause Spotlight to misbehave. For instance, it refuses to index a clone — a drive that has been duplicated with a utility such as SuperDuper. To fix the problem, you need to deal with two invisible files on the problem drive. (To toggle them visible/invisible type Shift-CMD-period at any time in Finder.)

Step 1. Delete this file:
.metadata_never_index_unless_rootfs.
You will see it in the drive’s root (top) level.
Step 2. Edit this file:
VolumeConfiguration.plist
You will see it inside the folder named /.Spotlight-V100. Use a text editor (NOT a word processor!) such as BBEdit to replace these lines

	<key>Exclusions</key>
	<array>
		<string>/</string>
	</array>

with these lines:

	<key>Exclusions</key>
	<array/>
	<key>Options</key>

Save and close the file.

Step 3. Eject the drive, then remount it. (System reads these files only once, at the time of mounting.)

Performing Step 1 without Step 2 has no effect.
Performing Step 2 without Step 1 has no effect.

To check for success, launch Terminal, and issue this command:
sudo mdutil -a -i on /
It will report which drives have Spotlight enabled and which do not.

5 Likes

I rebooted my Mac, and then entered

sudo mdutil -i on “/Volumes/”

Then all was good. Spotlight enabled, and appears to be working as expected! Yay! :grinning:

1 Like