Skip to main content

Set Wallpaper on MacOS

  • September 14, 2020
  • 0 replies
  • 120 views

This script will set the wallpaper for Mac devices to one of your choosing. Just upload the wallpaper and adjust naming as needed. Please note, if a user has not previously allowed Finder in AppleEvents, they may get a prompt to allow. (If they accidently hit no to allow, AppleEvents can be reset using the command “tccutil reset AppleEvents”)

#!/bin/bash

#copy the .png file to the device
scp DesktopWallpaper.png /library/

#Set wallpaper for user
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{print $3}')
sudo -u "$currentUser" -H osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/library/DesktopWallpaper.png"'

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings