Category filter

Script to open apps on Mac

Jump To

To open an application on their system, users will have to find the app and double click on the app icon. With shell scripts, you need not know or navigate to the location of the app on the system, you can simply specify the app name or identifier to open the app. Moreover, you can open multiple apps from a single line command. This method is not only quick but also an effective way to remotely launch applications on a Mac.

Device admins can remotely run scripts on Macs managed with Hexnode using the Execute Custom Script action.

Scripting language – Bash

File extension – .sh

Disclaimer:


The sample scripts provided below are adapted from third-party open-source sites.

Open an app

The open command can be used to open a file, directory, or URL. Some of the options supported with the open command in this respect are –

-a

  • It specifies the name of the application to open. For example,
  • open -a “App Store”

-b

  • It specifies the bundle identifier of the application to open. For example,
  • open -b com.apple.AppStore

-g

  • It opens the application in the background. For example,
  • open -g -a “App Store”

-n

  • It opens a new instance of the application if it is already running. For example,
  • open -n -a “App Store”

-j

  • It launches the app hidden. For example,
  • open -j -a “App Store”

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository