2021-12-13

Spotlight on macOS using a lot of CPU

If you are a developer on macOS and notice Spotlight consuming a lot of CPU the reason could be that Spotlight is indexing the Simulator and Platforms directories. When I ran lsof and checked the files that spotlight was accessing, it was reading files in ~/Library/Developer/CoreSimulator and /Applications/Xcode.app/Contents/Developer/Platforms. Adding those two directories to the Spotlight Privacy tab and then restarting your computer will prevent Spotlight from indexing them. Go to System Preferences > Spotlight > Privacy to add them.

PreferenceKey Quirks

PreferenceKey has a few quirks that have tripped me up. One is the reduce(value:nextValue:) implementation. The other is that a PreferenceKe...