Launch and terminate apps on macOS
If you're on macOS 10.14.3 or earlier, you need to download the Swift runtime support libraries.
$ npm install macos-manage-apps
const {launchApp, terminateApp} = require('macos-manage-apps');
(async () => {
await launchApp('com.sindresorhus.Dato');
await terminateApp('com.sindresorhus.Dato');
})();
launchApp(bundleId: string): Promise<true>
Tries to launch the app with the given bundle identifier. It will resolve if it succeeds, and reject with an error otherwise.
bundleId
The bundle identifier of the app.
terminateApp(bundleId: string): Promise<true>
Tries to terminate the app with the given bundle identifier. It will resolve if it succeeds, and reject with an error otherwise.
bundleId
The bundle identifier of the app.
isAppRunning(bundleId: string): Promise<true>
Check whether the app with the given bundle identifier is running. It will resolve with true if it's running and false otherwise.
bundleId
The bundle identifier of the app.
MIT