Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Summary. Automation changes desktop background for all (virtual) desktops, but no all monitors. How to do it for all monitors?


This blog entry discusses how to automatically change background for all (virtual / Mission Control / etc) desktops with following script:

#! /bin/bash
#script to change all desktop backgrounds
echo -n “Drag and drop an image file here then press ‘return’ or press ‘control-c’ to cancel…”
read -e WLPR;
function change_wallpaper
defaults write Background "{default = {ImageFilePath='$WLPR'; };}"; killall Dock

However, it doesn't change the desktop background on my 2nd monitor on my Lion-based system for any of my Mission-Controlled desktops. How does one apply above (or similar) to all physical monitors? (Hacks like this unattractive.)

share|improve this question

I have dual monitor Mac at work so I will be able to give it a try tomorrow (day off today).

I think if you were to compare the output of:

$ defaults read

Before and after having manually changed the wallpaper via:

System Preferences > Desktop & Screen Saver > Desktop

That, should, bring up a window in the second display allowing you to select required image. Once that is setup and working, compare the output from the original command and see if it gives you any clues. I shall do the same tommorow and play around it with it. See if I can't give you a more complete answer.

share|improve this answer

I'm afraid this isn't a complete answer, since I haven't yet found a way to make this work with multiple desktops, but it will set the desktop of all monitors in the current space to whatever picture you specify.

on run {input, parameters}
    set theFile to first item of input
    tell application "System Events"
        set theDesktops to a reference to every desktop
        repeat with aDesktop in theDesktops
            set the picture of aDesktop to theFile
        end repeat
    end tell
    return theFile
end run

Add that to a Run AppleScript action in an Automator workflow, and save it as an application. You can then drag and drop an image onto the application and it will be set as the desktop image.

Perhaps someone can find a way to make this work with multiple spaces/desktops.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.