Skip to main content

Previously the script below from another message made it possible to have custom screensaver files (Photos) that would rotate.  This no longer works in macOS Sonoma.  Does anyone know a new method to have the screensaver call photos from a particular folder in somona via a script or another way.


#!/bin/sh

## get current user
user=`ls -l /dev/console | cut -d " " -f 4`

## get macOS version(s)
osMajor=$(/usr/bin/sw_vers -productVersion | /usr/bin/awk -F"." '{print $2}')
osMinor=$(/usr/bin/sw_vers -productVersion | /usr/bin/awk -F"." '{print $3}')

## set key items for screensaver
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.screensaver CleanExit -string "YES"
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.screensaver PrefsVersion -int 100
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.screensaver showClock -string "NO"
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.screensaver idleTime -int 60

## configure screensaver framework based on macOS version
if [[ $osMajor -eq 14 ]] && [[ $osMinor -ge 2 ]]; then
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName -string "iLifeSlideshows" path -string "/System/Library/Frameworks/ScreenSaver.framework/PlugIns/iLifeSlideshows.appex" type -int 0
else
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName -string "iLifeSlideshows" path -string "/System/Library/Frameworks/ScreenSaver.framework/Resources/iLifeSlideshows.saver" type -int 0
fi

## additional configuration settings for screensaver framework
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.screensaver tokenRemovalAction -int 0
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.ScreenSaverPhotoChooser LastViewedPhotoPath -string ""
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.ScreenSaverPhotoChooser SelectedFolderPath -string "/Users/Shared/Screensaver"
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.ScreenSaverPhotoChooser SelectedSource -int 3
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.ScreenSaverPhotoChooser ShufflesPhotos -bool "false"
/usr/bin/sudo -u $user /usr/bin/defaults -currentHost write com.apple.ScreenSaver.iLifeSlideShows styleKey -string "Classic"
/usr/bin/sudo /usr/bin/killall -hup cfprefsd
exit 0

@shrisivakumaran  Should this work if the device is at the login screen.


For login screen image you need to change wall paper.

If the screen saver starts then it will show screen saver image on the login screen else it will show wall paper image


I’ve updated my script i used in our university to include the functionality from https://github.com/itjimbo/macOS-Screen-Saver-and-Wallpaper, which activates the screensaver in macOS 14/15. Here’s my revised version: https://github.com/xdamn/WS1_Jamf. Feel free to check it out and see if it helps! Works on Airwatch and Intunes as well.


Hi All, 


we have been using itjimbo's solution for a few years now with Sonoma, it was going fine until new builds started on Sequoia 15.3.1 onwardss, seems now that the Base64 Key that you need to import from /Users/UserID/Library/Application Support/com.apple.wallpaper/Store/index.plist to the setting script is not longer set unless any choice is made for a screensaver, can anyone else confirm this, example of the missing base64 block:-
        <key>Choices</key>
<array>
<dict>
<key>Configuration</key>
<data>
</data>
<key>Files</key>
<array/>
<key>Provider</key>
<string>default</string>
</dict>
</array>
<key>Shuffle</key>
<string>$null</string>
</dict>
<key>LastSet</key>
<date>2025-03-11T20:10:36Z</date>
<key>LastUse</key>
<date>2025-03-14T13:16:36Z</date>
</dict>


as soon as you select something it appears so maybe the solution if needed is to some how set the default first like a bit of applescript as of course we don't allow the screensaver pane to be opened to keep the current config.  i have manged to do three samples where this is a issue





Hi All, 


we have been using itjimbo's solution for a few years now with Sonoma, it was going fine until new builds started on Sequoia 15.3.1 onwardss, seems now that the Base64 Key that you need to import from /Users/UserID/Library/Application Support/com.apple.wallpaper/Store/index.plist to the setting script is not longer set unless any choice is made for a screensaver, can anyone else confirm this, example of the missing base64 block:-
        <key>Choices</key>
<array>
<dict>
<key>Configuration</key>
<data>
</data>
<key>Files</key>
<array/>
<key>Provider</key>
<string>default</string>
</dict>
</array>
<key>Shuffle</key>
<string>$null</string>
</dict>
<key>LastSet</key>
<date>2025-03-11T20:10:36Z</date>
<key>LastUse</key>
<date>2025-03-14T13:16:36Z</date>
</dict>


as soon as you select something it appears so maybe the solution if needed is to some how set the default first like a bit of applescript as of course we don't allow the screensaver pane to be opened to keep the current config.  i have manged to do three samples where this is a issue





I will test this. I really hope it's not broken. Getting this working last year was a pain and I think it was a total waste of my time.


any luck @howie_isaacks , i did try a bit of applescript to set any screensaver to get the Base64 key in but it didn't work as far as i can tell


 


any luck @howie_isaacks , i did try a bit of applescript to set any screensaver to get the Base64 key in but it didn't work as far as i can tell


 


Without making any modifications, I ran the complete process on a Mac running macOS Sequoia 15.3.2. It worked exactly as expected. Before doing this I did not do anything with the screen saver. This was a newly installed OS. I checked ~/Library/Application Support/com.apple.wallpaper/Store/Index.plist and saw that the base64 generated from the initial setup script was there. If this data did not make it into the plist you should check your process that is supposed to put it there. Something may have been changed if it was working before.