Category filter

Script to set screen saver on Mac

Configured to be activated after a specific period of device inactivity, screen saver plays a crucial role in protecting confidential information when the users are away from the device screen. This doc helps you configure screen saver on macOS devices using a script that can be executed with Hexnode’s Execute Custom Script action. The script lets you set up a screen saver photo slideshow across the devices.

Scripting language – Bash

File extension – .sh


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


The script will only affect the currently logged in user.

Set slideshow screen saver

Here’s a sample script to set a screen saver photo slideshow. You can set the images to be displayed, the idle time after which the screen saver needs to be enabled, the slideshow style, and also choose to shuffle the images

Style – This field takes into consideration the style of the slideshow to be deployed. Provide the name of the style you would like to set on the device. Apple provides a bunch of options you can choose from:

  • Floating
  • Flip-up
  • Reflections
  • Origami
  • Shifting Tiles
  • Sliding Panels
  • Photo Mobile
  • Holiday Mobile
  • Photo Wall
  • Vintage Prints
  • Ken Burns
  • Classic

IdleTime – Provide the inactivity period (in seconds) after which the screen saver should activate. The value ‘0’ sets the screen saver to be never activated.

ShufflePhotos – Provide ‘true’ or ‘false’ based on whether you want the images for the slideshow to be shuffled. If the value is set as ‘false’, the images will be displayed in the order they appear in the source folder.

Photosfolderpath – Provide the path to the folder that contains the images for the slideshow as an argument. For example, to deploy a slideshow screen saver for images stored at ‘/Users/jacob/Desktop/ScreenSavers’, specify it in the Arguments field while executing the action.

Path to the folder provided as an argument


  • 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