macOS 12 Monterey includes fundamental changes on how Apple-supplied Desktop images are sourced and where they are located. This has limited the scripts effectiveness. A Desktop image now needs to be downloaded manually before the script can set it as the Desktop picture. For more details read Changes Since macOS 11 Big Sur.
Set a user's Desktop image in macOS 12 Monterey from the command line. See Limitations
- macos 10.14 Mojave (macOS 12 Monterey required for the examples below to work)
- Bash 3.2 (Monterey ships with 3.2.57)
- Python 2.7 (Monterey ships with 2.7.16)
An explanation of how Desktop images appear to be managed by macOS since Mojave (10.14) can be found at Setting the Desktop Image in macOS Mojave From the Command Line. While this article was written before the release of Monterey, the majority of the information is still relevant.
-
Download macos-desktop-main.zip
-
Double-click
~/Downloads/macos-desktop-main.zip
in the Finder to unzip it (Safari may do this automatically) -
Open the Terminal application in macOS
-
At a Terminal prompt:
-
type
cd ~/Downloads/macos-desktop-main
and press enter -
type
chmod +x set-desktop.sh options.py Monterey\ Tests/set-desktop-monterey-tests.sh
and press enter to make the scripts executable
-
-
See the Examples section for using the
set-desktop.sh
script -
See the Valid Options section for using the
options.py
script -
See the Tests section for using the
set-desktop-monterey-tests.sh
script
./set-desktop.sh IMAGE
IMAGE
can be either
- a pre-defined named option
- the path to an image file
See the Valid Options and Examples sections for more information.
These examples use the Apple-supplied Deskop pictures that could otherwise be set via System Preferences. They are categorised and listed as they appear in the Desktop & Screensaver pane as of macOS 12.0.1 Monterey (21A559).
See A Comparison of Apple-supplied Desktop Images Since macOS 10.14 Mojave
Setting the image to Dynamic (e.g. The Beach Dynamic) ensures it changes throughout the day, based on your location.
./set-desktop.sh graphic
./set-desktop.sh light
./set-desktop.sh dark
./set-desktop.sh big-sur
./set-desktop.sh big-sur-light
./set-desktop.sh big-sur-dark
./set-desktop.sh catalina
./set-desktop.sh catalina-light
./set-desktop.sh catalina-dark
./set-desktop.sh cliffs
./set-desktop.sh cliffs-light
./set-desktop.sh cliffs-dark
./set-desktop.sh lake
./set-desktop.sh lake-light
./set-desktop.sh lake-dark
./set-desktop.sh desert
./set-desktop.sh desert-light
./set-desktop.sh desert-dark
./set-desktop.sh beach
./set-desktop.sh beach-light
./set-desktop.sh beach-dark
./set-desktop.sh solar
Setting the image to Automatic (e.g. Peak Automatic) ensures it conforms to the Light, Dark or Auto setting in System Preferences > General > Appearance.
./set-desktop.sh green
./set-desktop.sh green-light
./set-desktop.sh green-dark
./set-desktop.sh yellow
./set-desktop.sh yellow-light
./set-desktop.sh yellow-dark
./set-desktop.sh orange
./set-desktop.sh orange-light
./set-desktop.sh orange-dark
./set-desktop.sh pink
./set-desktop.sh pink-light
./set-desktop.sh pink-dark
./set-desktop.sh purple
./set-desktop.sh purple-light
./set-desktop.sh purple-dark
./set-desktop.sh blue
./set-desktop.sh blue-light
./set-desktop.sh blue-dark
./set-desktop.sh silver
./set-desktop.sh silver-light
./set-desktop.sh silver-dark
./set-desktop.sh big-sur-graphic
./set-desktop.sh big-sur-graphic-light
./set-desktop.sh big-sur-graphic-dark
./set-desktop.sh peak
./set-desktop.sh peak-light
./set-desktop.sh peak-dark
./set-desktop.sh tree
./set-desktop.sh tree-light
./set-desktop.sh tree-dark
./set-desktop.sh valley
./set-desktop.sh valley-light
./set-desktop.sh valley-dark
./set-desktop.sh dome
./set-desktop.sh dome-light
./set-desktop.sh dome-dark
./set-desktop.sh red
./set-desktop.sh red-light
./set-desktop.sh red-dark
./set-desktop.sh blue
./set-desktop.sh blue-light
./set-desktop.sh blue-dark
./set-desktop.sh iridescence
./set-desktop.sh iridescence-light
./set-desktop.sh iridescence-dark
./set-desktop.sh mountains
./set-desktop.sh aerial
./set-desktop.sh horizon
./set-desktop.sh coastline
./set-desktop.sh shore
./set-desktop.sh edge
./set-desktop.sh road
./set-desktop.sh succulents
./set-desktop.sh grasses
./set-desktop.sh coast
./set-desktop.sh evening
./set-desktop.sh rock
./set-desktop.sh shoreline
./set-desktop.sh clouds
./set-desktop.sh silhouette
./set-desktop.sh sunset
./set-desktop.sh stream-red
./set-desktop.sh stream-blue
./set-desktop.sh stream-pink
./set-desktop.sh stream-green
./set-desktop.sh studio
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Black.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Blue Violet.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Cyan.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Dusty Rose.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Electric Blue.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Gold 2.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Gold.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Ocher.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Plum.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Red Orange.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Rose Gold.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Silver.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Soft Pink.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Space Gray Pro.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Space Gray.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Stone.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Teal.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Turquoise Green.png"
./set-desktop.sh "/System/Library/Desktop Pictures/Solid Colors/Yellow.png"
1 If the image doesn't exist it will be downloaded to the $HOME/Library/Application Support/com.apple.mobileAssetDesktop/
directory first.
./set-desktop.sh default
./set-desktop.sh "/path/to/desktop/image.jpg"
ERROR: For use with macOS 10.14 Mojave or later.
ERROR: Can't find configuration file 'options.json'.
ERROR: No image was specified.
ERROR: </path/to/desktop/image.jpg> doesn't exist.
###### Supplied Desktop image file hasn't been downloaded
ERROR: Please download <desktop picture> via System Preferences first, then re-run this script.
ERROR: <option> is not a valid option.
ERROR: The 'default' option is only appropriate when the database is ~/Library/Application Support/Dock/desktoppicture.db
ERROR: This script should not be used in a dual-monitor environment.
ERROR: This script should not be used when multiple Desktops (Spaces) are configured.
Works only with a single Desktop (Space) in a single-display environment.
Not for use with multiple Desktops (Spaces) or in a dual-display environment.
All valid options and their corresponding data are stored in the file options.json
. To list these options for Monterey use the following:
-
unsorted in the order they appear in
options.json
use./options.py --version monterey
-
sorted by
category
use./options.py --version monterey --sort category
-
sorted by
name
use./options.py --version monterey --sort name
-
sorted by
option
use./options.py --version monterey --sort option
The set-desktop-monterey-tests.sh
script in the Monterey Tests
directory executes set-desktop.sh
a given number of times (the default is 5 if omitted), each time passing it an option or filename randomly selected from desktop-images.txt
.
The intention is to document the state of the data
and preferences
tables in the desktoppicture.db
database after each iteration. Output is written to set-desktop-monterey-tests.txt
To change the Desktop picture 100 times, cd
into the Monterey Tests
directory and type ./set-desktop-monterey-tests.sh 100
macOS Monterey has introduced some fundamental changes to where Desktop pictures are located and how they are initially created. This has provided some challenges in changing the set-desktop.sh
script to support these changes.
-
Only one new Desktop picture named macOS Graphic is included and is now the default.
-
In System Preferences > Desktop & Screensaver > Desktop it is the first thumbnail in the Light and Dark Desktop category.
-
There are options for Automatic, Light (Still) and Dark (Still).
-
The image file is
/System/Library/Desktop Pictures/macOS Graphic.heic
-
With the exception of
macOS Graphic.heic
andBig Sur Graphic.heic
all images with a.heic
extension in/System/Library/Desktop Pictures/
that existed in Big Sur and earlier releases of macOS have been replaced by files with a.madesktop
extension e.g.Catalina.heic
is nowCatalina.madesktop
. -
Each file with a
.madesktop
extension is an XML file containing amongst other data the path to a thumbnail image that is displayed in System Preferences > Desktop & Screensaver > Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>mobileAssetID</key>
<string>Catalina</string>
<key>thumbnailPath</key>
<string>/System/Library/Desktop Pictures/.thumbnails/Catalina.heic</string>
<key>isDynamic</key>
<true/>
<key>isSolar</key>
<true/>
<key>width</key>
<real>6016.0</real>
<key>height</key>
<real>6016.0</real>
</dict>
</plist>
-
With the exception of
macOS Graphic.heic
andBig Sur Graphic.heic
the full size images used for the Desktop pictures no longer exist on a fresh install of macOS Monterey. This is evident from the download icon on each of the Desktop picture thumbnails in System Preferences > Desktop & Screensaver > Desktop. -
The Desktop picture can only be set to the selected
.heic
image after it has been explicitly downloaded by clicking the download icon. -
The image is no longer located in the
/System/Library/Desktop Pictures/
directory as in previous macOS versions, but a zip file containing the image is downloadedto theand the image placed in the/System/Library/AssetsV2/com_apple_MobileAsset_DesktopPicture/
directory.$HOME/Library/Application Support/com.apple.mobileAssetDesktop/
directory. -
The URL of the zip file
and the name and location of the directory created when it's expandedis stored in/System/Library/AssetsV2/com_apple_MobileAsset_DesktopPicture/com_apple_MobileAsset_DesktopPicture.xml
.
<dict>
....
<key>DesktopPictureID</key>
<string>Catalina</string>
....
<key>__BaseURL</key>
<string>http://updates-http.cdn-apple.com/2021/mobileassets/071-34545/7E2884C0-2F21-4028-B22E-2EA162B35135/</string>
....
<key>__RelativePath</key>
<string>com_apple_MobileAsset_DesktopPicture/28e590448a1795ffd7d8ae9c9f826ceedd9696a2.zip</string>
....
</dict>
- Using
Catalina.heic
as an example:- the zip file is located at
__BaseURL
+__RelativePath
- when unzipped, a parent folder named after the zip file is created
- the zip file is located at
/
|-- System/
|-- Library/
|-- AssetsV2/
|-- com_apple_MobileAsset_DesktopPicture/
|-- 28e590448a1795ffd7d8ae9c9f826ceedd9696a2/ <--- Created when zip file expanded
|-- AssetData//
|-- Catalina.heic <--- Desktop picture
|-- Info.plist
|-- META-INF/
|-- com.apple.ZipMetadata.plist
All of the macOS Monterey developer betas used to test this script placed images downloaded through System Preferences in the non-writable /System/Library/AssetsV2/com_apple_MobileAsset_DesktopPicture/
directory. This limited the scripts effectiveness.
At some stage during the macOS Monterey release cycle this location changed to the writable $HOME/Library/Application Support/com.apple.mobileAssetDesktop/
directory. I noticed this as of macOS Monterey 12.3.1, but it may have happened as far back as the initial publice release on 25th October 2021 as is evident from this Apple StackExchange post back in November 2021.
The current version of the script can now download the Desktop image if it doesn't already exist.
If the set-desktop.sh
script is used to set the Desktop picture to say Catalina Dynamic and Catalina.heic
doesn't exist, it first needs to be downloaded and placed in the correct directory (see above). This would be fairly easy to achieve if it weren't for System Integrity Protection (SIP) which prevents the /System
directory from being written to.
The options for the script are:
1. Disable SIP before running the script.
Rejected: SIP is enabled by default and disabling it is not a trivial matter nor perhaps desirable. Even if it were, disabling SIP is not something the script would be able to do as it requires considerable user intervention.
2. Have the script download and place missing Desktop picture image files in a writable directory.
The script can use existing Desktop picture image files in the /System/Library/AssetsV2/com_apple_MobileAsset_DesktopPicture/
directory and download and place missing Desktop picture image files in a newley-created writable directory say ~/Library/Application Support/AssetsV2/com_apple_MobileAsset_DesktopPicture/Dock
. This is the location of desktoppicture.db
, the database that stores the current Desktop picture.
Rejected: This does work, but with one big caveat. After the script has set the Desktop picture to an .heic
image in a location other than the /System/Library/AssetsV2/com_apple_MobileAsset_DesktopPicture/
directory the dropdown menu for the selected image in System Preferences > Desktop & Screensaver > Desktop shows...
However, for Desktop pictures in the Dynamic Desktop category the options should be Dynamic, Light (Still) and Dark (Still). For the Light and Dark Desktop category, the Dynamic option is replaced by Automatic.
3. Have the script use existing Desktop picture image files in the /System/Library/AssetsV2/com_apple_MobileAsset_DesktopPicture/
and prompt the user to download any missing image file via System Preferences > Desktop & Screensaver > Desktop.
This is how the current version of the script functions.
-
New Desktop pictures included in the Light and Dark Desktop Category in System Preferences > Desktop & Screensaver > Desktop:
- Hello Green (hello Green.heic)
- Hello Yellow (hello Yellow.heic)
- Hello Orange (hello Orange.heic)
- Hello Pink (hello Red.heic)
- Hello Purple (hello Purple.heic)
- Hello Blue (hello Blue.heic)
- Hello Silver (hello Grey.heic)
-
Like other Desktop pictures in the Light and Dark Desktop category, there are options for Automatic, Light (Still) and Dark (Still).
-
The image files are located in the
/System/Library/Desktop Pictures/
directory and do not need to be downloaded via System Preferences. These files have existed in this directory since Big Sur and the release of the new 24" iMac, but this is the first time thay've been included as options in System Preferences.
Back to TOC