Home > AppleScript, Mac administration, Mac OS X, Scripting > Mavericks desktop background picture settings moved from ~/Library/Preferences/com.apple.desktop.plist

Mavericks desktop background picture settings moved from ~/Library/Preferences/com.apple.desktop.plist

While I was preparing for Mavericks’ release, I ran across little details that had changed between Mountain Lion and Mavericks. One such detail is that the desktop background picture settings have moved.

In Mountain Lion, they were stored in the following location:


Screen Shot 2013-10-26 at 11.07.50 AM

In Mavericks, the settings have been moved to a SQLite database at the following location:

/Users/username/Library/Application Support/Dock/desktoppicture.db

Screen Shot 2013-10-26 at 11.11.19 AM

Removing desktoppicture.db causes the desktop picture to reset to whatever image is stored as /System/Library/CoreServices/DefaultDesktop.jpg

Fortunately, there are still ways to manage the desktop background picture if that’s needed. For the details, see below the jump.

Change OS X’s DefaultDesktop.jpg to set the desktop picture

Going back to 10.5.x, an easy way to set the default desktop wallpaper in OS X has been to replace the /System/Library/CoreServices/DefaultDesktop.jpg file with your own .jpg file. This method still works in Mavericks and is the approach I’ve taken in my own shop for setting the default desktop background for new accounts.

Deploying a pre-configured database to set the desktop picture

In my own shop, I wanted to set the desktop picture to be different from DefaultDesktop.jpg for one particular account: our local admin account. To help our techs quickly identify which OS they’re working on, we’ve been setting the background to match the OS version’s name:

10.6 – Snow Leopard picture


10.7 – Lion picture

10.8 – Mountain Lion picture

10.9 – Mavericks Wave picture

After attempting to script it, the approach I decided to use was to set the desktop picture on one machine for the local admin account, then I copied the database file. From there, I built a package to drop the database file in the right place on new machine setups. This approach has worked great to set the desktop background for my local admin account.

Setting the desktop picture with AppleScript

You can use AppleScript via osascript to set the desktop background using this command:

osascript -e "tell application \"System Events\" to set picture of every desktop to \"/path/to/image.jpg\""

Setting the desktop picture with PyObjC

Greg Neagle has developed a PyObjC script to set the desktop picture.

  1. October 28, 2013 at 4:53 pm

    Will future 10.9 OS updates overwrite the DefaultDesktop.jpg ?

    • November 1, 2013 at 4:57 pm

      unknown but possible and as a rule, don’t play around in /System/Library unless you have to

  2. November 3, 2013 at 12:34 pm
  3. Melanie
    November 6, 2013 at 10:46 pm

    Will removing desktoppicture.db help restore the Dock as well? After I tried changing my background picture (after which my computer is now stuck on a gray background no matter what I do), I lost my Dock after restarting my computer. killall Dock doesn’t work to bring it back, and I still can’t change my desktop picture.

  4. November 15, 2013 at 1:49 pm

    How are you running Greg’s script from Casper? I’m not au fait with Python so I don’t know how you’d get it to run as the currently logged in user rather than as the management account.

  5. November 26, 2013 at 11:10 am

    I gave up trying to get an answer from Apple to fix this issue in Mavericks and used Automator to write an App that changes the desktop to a predetermined image and opens via Login Items in WGM preferences. It works great!!! and if you limit Sys Prefs in WGM it is nearly as good as the old .plist method. You can “custom” make the app for any screen res or image choice so easily and drop in the applications folder via ARD etc. See my post on the Apple discussions. If any one needs any more info let me know

  6. November 26, 2013 at 11:22 am

    P.S. Profile manager will also support this log in item as a payload if you have moved from WGM. Just add the desktop app you want to your server’s Application folder and you can then choose from the PM payload window in Login Items from the Applications+ that will launch at log in. The beauty of this is that it opens with any user who logs in.Whilst not important in a home environment but in an Education Institution or Company the need to control potentially harmful or offensive images being displayed on a desktop screen is very desirable.

  7. Jennifer Snowdon
    November 28, 2013 at 4:14 pm

    To change Desktop photo, right click on the photo, go to Services and then Set Desktop Picture. No need to go into the library.

  8. Phil
    January 28, 2014 at 9:01 am


    This would be an out of the topic question. How can we temporarily disabled managed preferences in mavericks. We are still in WGM and clients mavericks. We use to clear the managed preferences by deleting /Library/Managed Preferences. However this is now not working in Mavericks

    Thanks in Advance

  9. Ryan N
    January 30, 2014 at 4:38 pm

    Is that Mountain Lion picture one that you found? I never had it when I got Mountain Lion… Didn’t they remove the andromeda wallpaper from Lion in Mavericks?

    • January 30, 2014 at 7:00 pm


      The mountain lion picture is one that I found. It was not included with 10.8.x.

  10. February 14, 2014 at 12:06 pm

    Can someone help modify Greg’s pyObjC script to include a
    “defaults read com.apple.desktop Background” (or perhaps a better CFpreferences way of reading this
    and then use the result of that to set the background?

    This could then be run as a LaunchAgent and basically bridge what ever is set in MCX and Mavericks for setting the Desktop Background.

    My PyObjC skills and CFpreferences skills are next to non-existent.

  11. February 18, 2014 at 9:24 am

    Putting this in a launch agent will do it (with the image set via MCX)

    x=`defaults read com.apple.desktop Background | grep ImageFilePath | sed s:\”::g | sed s:ImageFilePath::g | sed s/\ =\ //g | sed s:*\/Library:\/Library: | sed s:\;:: | sed -e ‘s/^[ \t]*//’`; osascript -e “tell application \”System Events\” to set picture of every desktop to \”$x\””

    • February 18, 2014 at 9:24 am

      there must be a cleaner way than I have done it though

  12. WAgner Mateo
    February 18, 2014 at 2:52 pm

    for our corporate builds, I just replaced /System/Library/CoreServices/DefaultDesktop.jpg with our own corporate wallpaper…..

  13. geoff lee
    May 6, 2014 at 3:52 pm

    FWIW, setting the desktop picture with MCX now works for me on 10.9.2 (I don’t know if it worked previously, but i just tried with the plist I use in 10.7 and 10.8, and it worked.

    • May 15, 2014 at 9:53 pm

      i’m on 10.9.2 and changing the MCX preferences don’t change the desktop? Can you tell us how you are getting it done?

  14. May 16, 2014 at 3:28 pm

    I beg to differ with this article. I mean I am pretty sure it works, but I have never had trouble changing the default desktop picture.

    What I do is I add our default picture to /Library/Desktop Pictures, then I make an alias of this Desktop Wallpaper and I rename the alias to DefaultDesktop.jpg then I place it on /System/Library/Core Services

    I then create a default user account and configure it, and from there the default desktop is that one, I dont have to go through all those steps above.

  15. June 16, 2014 at 6:01 am

    You can deploy a package that has the desktop picture.db to the same user’s Library/Application Support/Dock/. You can have a post install script that locks the file using chflags. Student might still change the background, but it will reset after logout.

  16. Chris Dawe
    August 2, 2014 at 3:31 pm

    Messing around with some new laptops running 10.9.4, I find that /System/Library/CoreServices/DefaultDesktop.jpg is now a symlink that points to /Library/Desktop Pictures/Wave.jpg. Conceivably this means that rather than replacing the picture you can now re-link to a different file.

  17. September 11, 2014 at 4:00 pm

    Tried running Greg’d script, but just get an error: “Permission denied”

    • Mike Priestley
      September 12, 2014 at 7:23 am

      Why not just use Mavericks profile manager it has a “lock desktop” for users and file path preference for the user desktop in “Restrictions”. This works great and means the desktop can be changed to reflect onscreen messages and info very quickly. I have moved all my 400 macs to profilemanager now and whilst not as good as WGM its getting there.

  18. XL4
    October 13, 2014 at 3:18 pm

    Quick question. I’m finding that after deploying a custom path and desktop image lock via PM, if you remove that profile/payload, the desktop remains locked and unchangeable as if the profile settings, though removed, are still active somewhere. Just can’t find where they are to remove them and put that setting back to default??

    • XL4
      October 13, 2014 at 4:08 pm

      So, may have found the solution/prob. The com.apple.MCX.plist had in it an entry for com.apple.desktop.plist (which doesn’t exist) I removed that entry from the MCX plist and settings went back to default FYI. Not sure why it still existed, and/or where it was reading from if the plist did not even exist?

    • Mike Priestley
      October 14, 2014 at 11:21 am

      Once the profile and preferences in Sys Prefs are deleted they should no longer be managing any settings in PM. You could try holding the alt key as you log in as admin and see if the disable management options box appears as this works for both PM and WGM as a way of turning off management settings locally. This option has to have been “checked” in the settings panel for it to work”Computer administrators may refresh or disable management”

  19. October 27, 2014 at 12:31 pm

    Thanks for great tip, but still have an issue. Removing the SQLlite db does reset the desktop, but i still cannot get the old “folders” location to reset, even after removing and replacing the com.apple.desktop.plist file (which is supposed to reset any preferences). Any idea on how to completely reset the desktop preferences to the default?

  20. Jimmy
    November 5, 2015 at 2:03 am

    This info was awesome for 10.9, unfortunately it looks like everything has changed with 10.10 (el capitan), which is typical of Apple, its not broken so lets move/change it!

    • Mike Priestley
      November 5, 2015 at 10:42 am

      Since 10.9 I have moved to Profile Manager for over 400 macs I manage whilst not as good as WGM does have a set and lock desktop in the Restrictions config profile. You can choose any desktop and the filepath for the client to use and a checkbox to prevent users changing it. WGM is now officially deprecated since 10.10 and should not be used as it will still open if you previuosly have it installed and create problems on your server.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: