Library/Desktop Pictures/NaahNananah.jpg When you pass a file desktoppr will set it as the desktop picture for all screens: $ desktoppr /Library/Desktop Pictures/NaahNananah.jpg Library/Desktop Pictures/LyricalGangster.jpg When you have multiple displays, desktoppr will list all desktop pictures: $ desktoppr Library/Desktop Pictures/High Sierra.jpgĪnd set the desktop picture with $ desktoppr "/Library/Desktop Pictures/BoringBlueDesktop.png" You can read the current desktop picture with: $ desktoppr Neil Martin had the brilliant idea to call it desktoppr. To do this, I wrote a simple command line tool which can read and set the desktop picture. This requires managing the client with a user-approved MDM.Īnother solution is to avoid AppleScript and Apple Events entirely. One solution would be to whitelist your management system’s agent which allows it to send Apple Events to the Finder. This will put a severe limit on the use of osascript for admin scripts. However, with macOS Mojave, Apple is introducing new Privacy and Security measures which require user approval for processes to send AppleEvents. Note that this sets a user preference so it should be run as the user. If you want to run this from a shell script you would execute it with osascript: osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Library/Desktop Pictures/Sierra.jpg"' The common means to do this has been to use an AppleScript command: tell application "Finder" to set desktop picture to POSIX file "/Library/Desktop Pictures/BoringBlueDesktop.png" In other, less tightly managed environments, you might prefer to set an initial desktop picture, but allow the user to change it later. This is very useful in education and other strictly managed environments. You would need to be able to remove the profile to change the desktop picture again. The user can still open the Desktop preference pane but the selection will be ignored. With this configuration profile in place, the desktop picture is locked. You can learn all the ways to manage and install profiles in my other book ‘Property Lists, Preferences and Profiles for Apple Administrators’ Many management systems will have an option in the ‘Restrictions’ payload where you can set the path to the desktop picture. You can set the desktop picture with a configuration profile. However, for better management you want to set the desktop picture as well. This will provide the image in a location that the user might look for. If you prefer, you can use munkipkg, which also simplifies and automates the process of building pkg installers. Read the book for a more detailed explanation of pkgbuild and the build script. I recommend using a script to run the pkgbuild command to avoid errors. If you get one of them slightly wrong it can lead to unexpected behavior or even break the installation. Note: the pkgbuild command has many options and arguments. The resulting pkg file will install the image file in /Library/Desktop Picture. Then you can build a pkg with $ pkgbuild -root payload -install-location "/Library/Desktop Pictures/" -identifier -version 1 BoringDesktop.pkg $ cp /path/to/BoringBlueDesktop.png payload Then copy the image to the payload folder. The new dynamic desktop pictures of macOS Mojave have the heic file extension.įirst create a project folder, with a payload folder inside: $ mkdir -p BoringDesktop/payload Note: Desktop pictures on macOS can be many file formats. You can use your own desktop picture or download BoringBlueDesktop.png from the book’s resources. I will use the same example desktop picture as in the book. Note: installing a single image file to /Library/Desktop Pictures is actually the first exercise/example in my book “Packaging for Apple Administrators.” Get that for a more detailed description. The best way of doing that is with an installer package. Unless you want to use one of the default macOS Desktop Picture images, you will first need to get the image file on to the client. One of the commonly used methods may break in macOS Mojave because of the new security and privacy controls for AppleEvents, also known as TCC. Many organisations like to set or pre-set the Desktop Picture of managed Macs.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |