Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Get A List Of Processes Running On A Mac With JavaScript

This script produces a list of the foreground and background processes running on a mac

Code

#!/usr/bin/env osascript -l JavaScript 

const processList = Application("System Events").applicationProcesses;
const appCount = processList.length;

for (let appIndex = 0; appIndex < appCount; appIndex ++) {
  console.log(processList[appIndex].name());
}

Results

loginwindow
ViewBridgeAuxiliary
SystemUIServer
Dock
ControlCenter
ViewBridgeAuxiliary
AppSSOAgent
QuickLookUIService
etc...
  • Link the post that shows how to do just the foreground apps