A while back I introduced desktoppr
. It is a very simple tool; its singular goal is to set the desktop picture (users and admins migrating from Windows call it ‘wallpaper,’ but that is not the proper macOS nomenclature) without requiring PPPC/TCC whitelisting.
The good news is that desktoppr
still works fine, nearly one-and-a-half years in! Even though Catalina brought in many changes and restrictions, desktoppr
kept doing its job.
Nevertheless, as I have used desktoppr
myself in several different deployments, and I have a few different approaches to deployment, depending on the requirements.
Catalina split system volume
One of the new features of Catalina is a read-only system volume, separate from the data volume. This means that the pre-installed desktop pictures are no longer in /Library/Desktop Pictures/
but can now be found in /System/Library/Desktop Pictures
. This is on the read-only part of the file system.
On a new “fresh” macOS installation, the /Library/Desktop Pictures
does not exist. However, when you create this folder, its contents will appear in the ‘Desktop’ preference pane, merged with the contents of the protected system folder. So, we can continue to use /Library/Desktop Pictures
as a place to store and install custom desktop image files.
Note: if you do not want the custom desktop picture to appear in the Desktop preference pane, then you can install the file in a different location.
/Users/Shared
or/Library/MyOrganization/
are useful locations.
Packaging the custom picture
> mkdir -p BoringDesktop/payload
> cd BoringDesktop
> cp /path/to/BoringBlueDesktop.png payload
> pkgbuild --root payload --install-location "/Library/Desktop Pictures/" --identifier com.example.BoringDesktop --version 1 BoringDesktop.pkg
These command will create a payload
folder, copy an image file (my example is BoringBlueDesktop.png
) and build an installation pkg using the pkgbuild
command.
If you want a more detailed explanation of this process, you can find it in my book: “Packaging for Apple Administrators”
Lock the Desktop
In classroom, lab, and kiosk settings, MacAdmins may want to set and lock the desktop picture. In this use case, you do not need desktoppr
at all.
Use the above pkg to install the image file and then use your management system to push a configuration profile that sets and locks a Desktop Picture.
Many management systems will have the desktop picture controls hidden in the ‘Restrictions’ payload among many other settings. Please consult the documentation. You can also use this custom profile that only controls the desktop setting.
Preset the desktop, but the let user change it
This is the most common way MacAdmins will want to deploy is to pre-set a custom Desktop Picture but allow the user to change it later. This is what desktoppr
was created for.
There are two approaches you can take to do this. Well, to be honest, there are way more, and all of them are valid, as long as they work. I should say: I will show two different approaches.
The modular approach
In this case you use your management system to install and run all the pieces:
- install the custom desktop picture using the above pkg
- install
desktoppr
using the pkg* - run a script that sets the desktop
* for 10.14.3 and earlier,
desktoppr
v0.2 requires the Swift 5 runtime support for command line tools to be installed.
The advantage of this approach is that we already did the first part earlier, and the desktoppr
pkg can be downloaded from the git repo,. So, we already have two of the three parts.
For the script, there is a sample script in the repository, as well.
Note that this script has changed slightly since the last post. Originally, the script used
launchctl asuser
. The behavior oflaunchctl asuser
seems to have changed somewhat in a recent update and I have switched the script to usesudo -u
instead.
This approach can be used with Munki, Jamf, outset, and many other management solutions.
All in one package
The downside of the modular approach is that you have to manage three pieces (the image file, the desktoppr
binary, and a script) in your management system. This can be especially problematic when you are not the actual administrator of the management system but more active in a ‘consulting role.’
In this case, I have found it easier to build a single package that does all the work. This is easier to hand over to another admin. It is also more flexible and can be used in even more situations. It is a bit more work to assemble, though.
First, you need the ‘ingredients:’
- the custom desktop picture image file (example:
BoringBlueDesktop.png
) - the
desktoppr
binary* (download the zip file here) - the
postinstall
script, which can be found in the repo examples directory - change the
picturepath
variable in line 9 to match your custom image file path
* for 10.14.3 and earlier,
desktoppr
v0.2 requires the Swift 5 runtime support for command line tools to be installed.
First, create a project folder with a payload
folder inside. Then copy the necessary files into the right place:
> mkdir -p BoringDesktop/payload
> cd BoringDesktop
Copy the image file to payload
:
> cp /path/to/BoringBlueDesktop.png payload
Create a scripts
directory and copy the postinstall
script to it:
> mkdir scripts
> cp path/to/desktoppr/examples/postinstall scripts
Expand the zip archive (in Finder) and copy the desktoppr
binary into the scripts
folder.
> cp path/to/build/usr/local/bin/desktoppr scripts
Your project folder should now look like this:
BoringDesktop Project Folder
You can then build the pkg with:
> pkgbuild --root payload --scripts scripts --install-location "/Library/Desktop Pictures/" --identifier com.example.BoringDesktop --version 2 BoringDesktop-2.pkg
Note the different version number, so the system can recognize this as a different pkg from the one you might have built earlier.
This form of the pkg does not actually install the desktoppr
binary on the target system. When the pkg is created, the entire contents of the scripts
folder will be archived into the pkg file. When the pkg is being installed, the contents will be expanded into a temporary directory. That means that the postinstall
script can see the binary in the same director ‘next to it.’ This happens in lines 22–27 of the postinstall
script.
After the installation is complete, the temporary files will be removed, so the postinstall
script and the desktoppr
binary will be removed automatically. You don’t need to worry about the cleanup.
Conclusion
Which approach works best depends on your specific deployment needs, your management setup and workflows and (not the least) your comfort with building scripts and packages.
Even when you have defined your deployment needs, there are multiple solutions on how to build and deploy a custom desktop picture. As long as they achieve the desired goal, there is no “best” solution.
You can earn more details about building packages in my book: “Packaging for Apple Administrators”
Our organisation images often aren’t sized appropriately for high res displays. Do you know any tips to also set a background colour?
This has been requested before. I finally found time to implement this: https://github.com/scriptingosx/desktoppr/releases/tag/v0.3