Category filter

Script to launch apps automatically while logging in to Mac

There might be specific apps that users launch every time they turn on their devices. It’ll be convenient to have these apps automatically opened as soon as the user logs in to the device. This can be done by specifying the required apps in the following script and running it from the Terminal app.

With Hexnode, you can deploy this script to your entire Mac fleet using the Execute Custom Script action.

Scripting Language – Bash

File extension – .sh


The Sample Scripts provided below are adapted from third-party Open-Source sites.

Launch Apps Automatically

Executing the above script on your Mac will create a launch agent for the specified app in /Library/LaunchAgents and runs for every user account upon logging in.

Replace app_name in the script with the name of the application you require to launch automatically on logging in to the Mac and specify the full path of the executable file for the application under the key.

For example, the following script will automatically launch the ‘Messages’ application when a user logs in to the Mac:


  • 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