macOS: Spotlight results not showing applications

Sometimes if your system restarts unexpectedly Spotlight stops working as expected. In this particular case it won’t show any Applications on the results despite the settings on System Preferences.

This will happen even if you disable and re-enable Spotlight through the GUI. The solution is do it via the CLI.

Stop Spotlight indexing:

# mdutil -a -i off
[...]
/Volumes/Untitled:
2020-01-26 10:59:42.019 mdutil[13212:548120] mdutil disabling Spotlight: /Volumes/Untitled -> kMDConfigSearchLevelFSSearchOnly
	Indexing disabled.

Stop Spotlight:

# launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Start Spotlight:

# launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Start Spotlight indexing:

# mdutil -a -i on
[...]
/Volumes/Untitled:
	Indexing enabled.

The results should now show applications.