I\'m looking for a solution to enumerate all applications installed on a (Mac) OS X system, i.e. all application bundles registered with LaunchServic
First, your request is not quite right:
I'm looking for a solution to enumerate all applications installed on a (Mac) OS X system, i.e. all application bundles registered with LaunchServices.
Those are not the same thing. The application bundles registered with LaunchServices is the output of lsregister -dump
. That is not the same thing as "all applications installed." There is no exact query for "all applications installed." OS X does not even really have such a concept.
The output of system_profiler
is equivalent to what Spotlight knows about. That's not exactly the full list of installed applications, and may not be correct in several cases. Spotlight may have been disabled, for instance, or it may not have completed its first scan. (There is no supported way to ask Spotlight if it has finished its first scan; radar 15177626.)
There is also pkgutil --pkgs
which will provide you additional "installed things." It isn't complete either, and may list things that are not installed.
You can also use mdfind
to walk the whole disk and see what calls itself an application. This is pretty effective, but slow.
You can also use locate .app | grep '\.app$'
which is pretty effective if the locate database is up to date and you only want app bundles.
I asked Apple about this at WWDC. There is no simple, supported answer. Open a radar. You can ask to dupe 15177489.
in terminal:
system_profiler SPApplicationsDataType > list_of_all_apps.txt
... writes output of the system_profiler query to that text file.
What about find using Cocoa application/code as done here.
Also, you might be able use to use system_profiler -xml SPApplicationsDataType
and then parse the resulting XML data to get just the applications that you are interested in.