What is the reliable approach to fetch a consistent and complete list of installed applications?

Is system_profiler the recommended approach for retrieving installed application data on macOS?

If not, what is the preferred and reliable alternative to fetch a consistent and complete list of installed applications?

Recommended, preferred and reliable?! That's a tall order! 😅

I can offer a few method, mdfind is super fast, it uses the content type names and values you can get with mdls <app path>

This one gets all application types, including .service files, the kMDItemContentTypeTree has a multiple of types in it

mdfind 'kMDItemContentTypeTree == com.apple.application'

This one doesn't include .service files since it uses the kMDItemContentType which can only have one value:

mdfind 'kMDItemContentType == com.apple.application-bundle'

Lastly (and the most slow), would be system_profiler. This one-liner assumed the Mac is macOS Tahoe which ships with jq:

system_profiler -json SPApplicationsDataType | jq -Mr '.. | .path? // empty'

Oh and this is UI only and doesn't export a list (although there probably is a way) but you can paste this in Script Editor to get a list of apps (that is considerably shorter than the other methods): choose application with prompt "Pick an app:"

What is the reliable approach to fetch a consistent and complete list of installed applications?
 
 
Q