Changing the desktop background from the command line in El Capitan

In Yosemite, I used Automator to assign a new desktop background every day because System Preferences, for some reason, does not give you the option to make it the same across all desktops. After upgrading to El Capitan, the script no longer works, nor do any of the solutions given in various places on the internet. I have tried the following:


sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "update data set value = 'Pictures/Wallpaper/paper.jpg'" && killall Dock - just resets the background to the default photo of El Capitan.

osascript -e 'tell application "Finder" to set desktop picture to POSIX file "Pictures/Wallpaper/paper.jpg"' - AppleEvent handler failed

defaults write com.apple.desktop Background '{default = {ImageFilePath = "Pictures/Wallpaper/6qrggmm.jpg"; }; }' && killall Dock - just makes the background solid blue

Posted on Nov 16, 2015 9:41 AM

Reply
3 replies

Nov 16, 2015 12:10 PM in response to JeffKo427

Hi,



This script works on El Capitan (need a full path of the file, doesn't need to quit the Dock):

osascript -e 'tell application "System Events" to set picture of every desktop to ("/Library/Desktop Pictures/Ducks on a Misty Pond.jpg" as POSIX file as alias)'



This script works with a valid full path (check the path of your file):

sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "update data set value = '/Library/Desktop Pictures/Ducks on a Misty Pond.jpg'" && killall Dock

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Changing the desktop background from the command line in El Capitan

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.