Category filter
Script to open apps on Mac
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
Open an app
1 2 |
#!/bin/bash open -a "App name" |
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”