Spotlight in macOS stores some of its indices and search data on your Startup Disk. Here’s how to minimize Spotlight using disk space.
Spotlight is Apple’s file indexing technology, which stores a database of the files on your Mac and their contents. When you type something into the Spotlight search bar by clicking on its icon in the menu bar in macOS, this index provides a fast and efficient lookup of what you’re searching for.
Over time, the indices Spotlight keeps on your Mac can grow to huge sizes – several hundred megabytes or more.
For various reasons, you may want to recover this disk space and refresh the Spotlight indices from time to time. There are several ways to accomplish this.
Use System Settings
In the macOS System Settings app, there’s a Spotlight item in the sidebar on the left. Clicking this item loads a list of checkboxes that allow you to set which file types you want Spotlight to index.
Turn off any file types or settings you don’t want Spotlight to use. This will reduce the size of the Spotlight data overall.
If you click the Search Privacy… button at the bottom of the Spotlight pane, you’ll get a sheet that allows you to exclude entire disk volumes or folders from being indexed. Keep in mind the volumes listed in this sheet are an exclusion list, not an inclusion list. Drag disk volumes or folders from the Finder to the sheet to exclude them from Spotlight indexing.
Remove the Spotlight index files in the Finder
The Spotlight index files and settings live on your Startup Disk at /Users/~/Library/Metadata/CoreSpotlight. In particular, the sub-folders “Priority” and “NSFileProtectionCompleteUntilFirstUserAuthentication” that contain the indexed data can become large.
Most of the other files/folders in the “CoreSpotlight’ folder are small and can be left alone or deleted.
When you move these files/folders to the Trash and Finder->Empty Trash, you delete the Spotlight indices from your Mac – and potentially save several hundred megabytes of disk space. Keep in mind, once you delete these files/folders, you will lose all stored Spotlight saved data until macOS rebuilds the indices.
Once you remove the files, you may want to restart your Mac.
Disable Spotlight indexing in the Terminal
If you’re comfortable using macOS’s Terminal app, you can turn off Spotlight indexing completely by using the command-line tool mdutil
. To do so, open the Terminal app and type:
sudo mdutil -i off
and press Return on your keyboard. Enter an admin password if prompted. This turns off Spotlight indexing.
To get a full list of mdutil
commands and options in Terminal, type:
man mdutil
and press Return. Exit the man system by pressing Control-Z or the q key on your keyboard.
Just be aware that when you turn off indexing, you might not get accurate results from then on if you type something into the Spotlight search bar.
Rebuild Spotlight indices
Apple has a page Rebuild the Spotlight index on your Mac which details how to force macOS to rebuild the Spotlight indices on your Mac.
To do so, first follow the steps described in another Apple technote If searching your Mac returns unexpected results.
Once this is done, follow the steps mentioned above in the System Settings app using the privacy sheet to re-add volumes and folders you want Spotlight to search.
Also see the page Spotlight settings on Mac.
Keeping your Spotlight data in order can save you disk space, and it doesn’t take too much effort, so you should consider periodic maintenance to keep Spotlight running as efficiently as possible.
This story originally appeared on Appleinsider