system_profiler applications inventory Running this:

system_profiler -detailLevel full


produces an inventory of applications, among other things.

How does they system "know" about these apps?


Spotlight? (e.g. every time a folder is created/renamed with the .app extension..)
searching the filesystem at the moment of invocation? (e.g. find -type d -name '*.app' ...)
scanning predefined paths?
other?


Would stopping the md service affect the output? Restoring from TimeMachine?

What I'd ultimately like to do is to query this "database", if it is a db and not some "just-in-time" query.

Useful queries:


Scan for outdated/insecure downloads of application X, if version >= Y
Is uTorrent present anywhere?
Does this system have PPC applications on it still?
etc.
I would suggest running opensnoop while running the system_profiler command.

I just did that, and with the full detail level as you have it there are over 25,000 files that are being read by system_profiler. It looks like it is reading plist files to get the output as well as reproducing various system logs.

If you stop md or restore from TimeMachine the output will change.