Spotlight on osx is a fantastic feature which will give you suggestions by searching your mac for documents and apps. This post will show you how to turn off spotlight search to disable spotlight search suggestions and free up some resources on your machine. There are lots of scenarios where you might not want to use spotlight. e.g. if you use alfred instead, if your machine is an older model or if you have a lot of files that take a long time to index.
While Spotlight does use resources on your mac, it doesn’t use a lot. A chunk of processing power is used when re-indexing a whole drive, or when your machine decides to index a plugged in usb drive, etc.
sudo mdutil -i off /
This command disables searching by turning off spotlight indexing and removing any existing indexes from your machine.
If you want to re-enable indexing and search then you need to
open terminal > type:
sudo mdutil -i on / && sudo mdutil -E /
This command makes sure indexing is on. The command erases your search databases. Spotlight will then rebuild the search indexes.
You can set the items for spotlight to show in a search by going to prefs > spotlight
Inside the preference pane you can exclude file-types and folders. This means you can configure spotlight so that it doesn’t show all your private info! You can also decide to exclude certain folders for example. Or only include specific folders (eg you can decide to only include your documents folder, or to only include your music folder) this will decrease the time taken to complete a full index, and will also use less resources on your machine while it is active. On my work machine, I have excluded the code folders as indexing takes a long time when spotlight decides to index these directories. I still index my documents and my applications [spotlight makes a great application launcher]
NAME mdutil -- manage the metadata stores used by Spotlight SYNOPSIS mdutil [-pEsav] [-i on | off] mountPoint ... DESCRIPTION The mdutil command is useful for managing the metadata stores for mounted volumes. The following options are available: -p Spotlight caches indexes of some network devices locally. This option requests that a local caches be flushed to the appropriate network device. -E This flag will cause each local store for the volumes indicated to be erased. The stores will be rebuilt if appropriate. -i on | off Sets the indexing status for the provided volumes to on or off. Note that indexing may be delayed due to low disk space or other conditions. -d Disables Spotlight searches on the provided volume. -s Display the indexing status of the listed volumes. -a Apply command to all volumes. -v Print verbose information when available.