Getting a list of all apps

I have a script I’ve been using for a few years based on one Christoper Stone posted here back in the day. It generates the version and build number of SD and Mac OS and puts them on the clipboard like this:

→ Script Debugger 8.0.1 (8A36)
→ Mac OS 11.6 (20G165)

This stopped working when I moved to SD8 because SD7 had been hard coded into the script.

I figured out how to get around that (easily) but looking at Chris’ code I realized I could make this work with any other application.

(So now it should work for SD 9 and SD 10 and SD11…)

For testing I’ve been using these apps:

→ BBEdit 14.0.1 (416084)
→ Google Chrome 94.0.4606.61 (4606.61)
→ Super SafeBox 2.0.0 (110)
→ Xcode 13.0 (19234)
→ Safari 15.0 (16612.
→ Microsoft Excel 16.53 (16.53.21091200)
→ Microsoft Outlook 16.53 (16.53.21091200)
→ Pages 11.2 (7032.0.145)
→ Script Debugger 8.0.1 (8A36)
→ Adobe InDesign 2021 (16400)
→ Slack 4.20.0 (6807)

→ Mac OS 11.6 (20G165)

I’m trying to figure out the best way to generate a list of which apps the user may want the versions for. Getting application processes from System Events takes forever, and only returns running apps. Contents of the application folders is a little quicker, but misses any apps not in those folders. Trying to get all apps would return all applets too. On my Mac that would be hundreds, if not thousands. (Some of our daily scripts are applets that get duplicated every day).

For now I’m thinking about making it a droplet that and storing previous apps.

Any suggestions?

Seems you can determine whether it’s an applet by checking its Info.plist's CFBundleExecutable.

This seems to work:

-- Get App URLs

-- Based on NigelGarvey's code (

use AppleScript version "2.4"
use framework "Foundation"
use scripting additions

set theFolderURL to current application's |NSURL|'s fileURLWithPath:"/Applications/"

set isPackageKey to current application's NSURLIsPackageKey
set theFileManager to current application's NSFileManager's defaultManager()
set allURLs to (theFileManager's enumeratorAtURL:theFolderURL includingPropertiesForKeys:{isPackageKey} options:((current application's NSDirectoryEnumerationSkipsPackageDescendants) + ((current application's NSDirectoryEnumerationSkipsHiddenFiles) as integer)) errorHandler:(missing value))'s allObjects()

set allAppAndAppletURLs to (allURLs's filteredArrayUsingPredicate:(current application's NSPredicate's predicateWithFormat:("self.path ENDSWITH " & quoted form of ".app")))

set allAppURLs to current application's NSMutableArray's new()

repeat with i from 0 to ((allAppAndAppletURLs's |count|()) - 1)
	set thisURL to (allAppAndAppletURLs's objectAtIndex:i)
	set thisBundle to (current application's NSBundle's bundleWithURL:thisURL)
	set thisInfoDictionary to thisBundle's infoDictionary()
	set thisCFBundleExecutable to (thisInfoDictionary's valueForKey:"CFBundleExecutable")
	if not (thisCFBundleExecutable's isEqualTo:"applet") then
		(allAppURLs's addObject:thisURL)
	end if
end repeat

return allAppURLs

isPackageKey isn’t needed, seems I didn’t clean up after trying that.

If you’re just after a one-off, then a shell script can enumerate them quickly by way of mdfind (provided your filesystem is indexed):

mdfind -literal kMDItemContentType==""c