Skip to content

Instantly share code, notes, and snippets.

@nicnilov
Forked from kappuchino/disable-spotlight.md
Created August 5, 2023 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicnilov/624098d4542458f35d804883c833e118 to your computer and use it in GitHub Desktop.
Save nicnilov/624098d4542458f35d804883c833e118 to your computer and use it in GitHub Desktop.

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

Commands

Disable the index:

mdutil -i off /

Enable the index:

mdutil -i on /

Erase the current Spotlight index:

mdutil -E /

Help

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.

Sources:

Special Files

  • On the root / 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.
  • On the root / 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.
  • UNVERIFIED Ending an folder in .noindex will disable indexing of the folder (I'll verify that asap). Example mkdir private-folder.noindex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment