Category filter

Script to schedule restart on Mac

Periodic rebooting of Mac is a good practice to ensure the devices work in top conditions. It regularly clears apps’ memory, fixes peripheral and hardware issues, improves device performance, and much more. However, administrators cannot completely rely on the end-users to perform the restart action occasionally. Most users prefer to keep their devices running all the time, making them ready for action whenever they need to. In such circumstances, IT can take advantage of the custom scripts in Hexnode to schedule the periodic restart of their Macs remotely.

Scripting language – Bash

File extension – .sh


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

Schedule restart on macOS devices

Replace hhmm with the hour and minute (in 24-hour notation) at which you need to schedule the restart of your managed devices. Once the script is executed, the devices will be rebooted at the specified time.


  • The given script may fail if the specified time is already passed on the target devices.
  • You can also execute the Restart Device action to reboot your macOS devices remotely at your convenience.
  • 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