MacOS – Prevent automatic removal of the Spotlight index due to low disk space

disk-spacemacosrepairspotlightssd

I am guessing that when disk space runs low, it automatically deletes the Spotlight index to make room for virtual memory. Then when space becomes available it reindexes. But I'm not sure about that.

Since my MacBook Air SSD is only 128 GB, I often work with little free disk space and the re-indexing drives me crazy.

I tried to disable Spotlight, remove its index and reindex.
Also check filesystem and repair permissions. In diagnostic reports (~/Library/Logs/DiagnosticReports/) nothing about reindexing is mentioned.

You can say that I should control the amount of free space but also should be another way. Disabling Spotlight isn't the option.

crosspost: https://discussions.apple.com/message/17321018#17321018

Best Answer

mdutil is the command line tool that controls Spotlight.

Looking at the mdutil man page, there doesn't appear to be an option to make the index persistent regardless of disk space. There is mention that "indexing may be delayed due to low disk space or other conditions".

One idea that comes to mind is that you can take away write permissions on your index files for all users, this should prevent them from being deleted, but it would also prevent them from being updated, and a static index is likely not desirable, and could cause errors. This might be worthy of testing, but I don't expect it would go very well.

It doesn't appear that Spotlight is designed to work in the way you are looking for. I would suggest submitting a feature request to Apple.