Disable:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
Enable:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
Disable:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
Enable:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
Disable the index:
mdutil -i off /
Enable the index:
mdutil -i on /
Erase the current Spotlight index:
mdutil -E /
Usage: mdutil -pEsa -i (on|off) -d volume ...
Utility to manage Spotlight indexes.
-p Publish metadata.
-i (on|off) Turn indexing on or off.
-d Disable Spotlight activity for volume (re-enable using -i on).
-E Erase and rebuild index.
-s Print indexing status.
-a Apply command to all volumes.
-V vol Apply command to all stores on the specified volume.
-v Display verbose information.
NOTE: Run as owner for network homes, otherwise run as root.
There is a thorough recent non-ai article here: https://eclecticlight.co/2024/07/09/excluding-folders-and-files-from-time-machine-spotlight-and-icloud-drive/
.noindex
will disable indexing of the folder. Example mkdir private-folder.noindex
. In former times it was .no_index, so beware the change. Similar is .nosync for keeping files out of sync with icloud./
directory of a internal or external Volume .metadata-never-index
will turn of indexing for the whole drive. Use the terminal to sudo touch \.metadata-never-index
for the root drive. Or use \Volumes\NAMEOFVOLUME\.metadata-never-index
for another drive./
directory of a (competing) boot drive with a version of OS X you can intelligently disable indexing by using .metadata_never_index_unless_rootfs
to prevent the data from the drive to appear unless it is the boot drive. Use the terminal to sudo touch \.metadata_never_index_unless_rootfs
. Or use \Volumes\NAMEOFVOLUME\.metadata_never_index_unless_rootfs
for another drive.So assuming your drives are external and you have the rights to modify them from the root fs, it would be
rm "/Volumes/HD2 - Projects/.metadata_never_index_unless_rootfs" and
rm "/Volumes/HD3 - Samples/.metadata_never_index_unless_rootfs" in the terminal
The sentinel files .metadata_never_index_unless_rootfs
and .metadata_never_index_unless_rootfs
are no longer obeyed by macOS Sequoia. Preventing Spotlight indexing can only be done through System Preferences.
Evidence: Try creating those sentinel files in the root of an external volume and run mdutil -s «path-to-external-volume-root»
on it.
The sentinel files
.metadata_never_index_unless_rootfs
and.metadata_never_index_unless_rootfs
are no longer obeyed by macOS Sequoia. Preventing Spotlight indexing can only be done through System Preferences.Evidence: Try creating those sentinel files in the root of an external volume and run
mdutil -s «path-to-external-volume-root»
on it.
Thank you, I updated the gist.
I found this post because I'm having major problems with Spotlight on a brand-new Mac with 4 external drives.
This comment above was helpful:
On the root / directory of a internal or external Volume .metadata-never-index will turn of indexing for the whole drive.
In fact, Terminal has indicated the presence of that file on two of my drives:
/Volumes/HD2 - Projects/.metadata_never_index_unless_rootfs
/Volumes/HD3 - Samples/.metadata_never_index_unless_rootfs
The question is how does one reverse this?! The comment above specifies that
.metadata-never-index
will turn OFF indexing for the whole drive. But how does one turn BACK ON indexing for the whole drive?