A Guide for Custom Screen Savers

New Contributor III

There is a lot of information about custom macOS screen savers and how to implement, but it took me a long time to sort through everything and find answers, so i am posting my findings here. I am going to try to keep it simple.

Task: Deploy a custom screen saver built by an in house developer using xcode in .saver format. Set the screen saver for the login window and the logged in user.

Part 1 - According to an Apple KB article, you cannot set a "Custom" screen saver at the login window. The article publish date is a bit stale, but after working with Jamf Support and my own testing, this still holds true up to macOS 10.15.2 (also tested on macOS 10.14.6). https://support.apple.com/en-us/HT202223

Part 2 - You can however set a screen saver for a logged in user. Package up your custom screen saver, install it at the /Library/Screen Savers/ path. Add the script below to Jamf Pro. This script was provided to me by Jamf Support.

Create a policy, set it for check-in once per computer (or ongoing as outlined in Step 3, keep reading), add the .dmg, add the script and scope it. See Part 3 for scoping instructions


screenSaverPath="/Library/Screen Savers"

user=$(last | grep "logged in" | grep "console" | awk '{print $1}');
huuid=$(system_profiler SPHardwareDataType | awk '/Hardware UUID/ {print $3}')

/usr/libexec/PlistBuddy -c "Set moduleDict:moduleName $screenSaverModuleName" /Users/$user/Library/Preferences/ByHost/com.apple.screensaver.$huuid.plist
/usr/libexec/PlistBuddy -c "Set moduleDict:path $screenSaverPath/$screenSaverFileName" /Users/$user/Library/Preferences/ByHost/com.apple.screensaver.$huuid.plist

setName=$(/usr/libexec/PlistBuddy -c "Print moduleDict:moduleName" /Users/$user/Library/Preferences/ByHost/com.apple.screensaver.$huuid.plist)
setFile=$(/usr/libexec/PlistBuddy -c "Print moduleDict:path" /Users/$user/Library/Preferences/ByHost/com.apple.screensaver.$huuid.plist)

killall cfprefsd

Part 3 - If you don't need to force the saver, you can simply scope this to All Devices or however you see fit.

If you do need to force this, you have 2 options. The first option is to use a Config Profile with Restrictions and lock down the "Desktop and Screen Saver" Sys Pref Pane. Once deployed, then scope the policy above to all devices. Do note, this will prevent the user from also setting a custom Desktop image. Most Admins will find, this is not a viable option.

The second option is what i chose, create an Extension Attribute which confirms the file is present on the device. Scope the policy above using a Smart Computer Group to anyone who does not have the file. Set this policy to run ongoing at check-in. Now anyone who deletes or renames the file will have it redeployed automagically. LastIy, I created a second policy. This second policy simply runs the script once per day at check-in, this will continually set the screen saver for anyone who might change it.

Final Thoughts - I hope this helps someone save time.


New Contributor

I tried using the script provided. The script runs successfully but then it removes the user's access from com.apple.screensaver.$huuid.plist file. Only does system will have access to the file and screensaver won't work

New Contributor

Part 2 I can't seem to figure out, how can I package a custom screen saver?