Set Wallpaper on macOS devices
  • 29 Sep 2023
  • 1 Minute to read
  • PDF

Set Wallpaper on macOS devices

  • PDF

Article Summary

The following Shell script helps IT Admins to deploy an image to their macOS devices and set it as a wallpaper.

  1. Create a file on your desktop, for example, SetWallpaper.sh and open it in a text editor like notepad++
  2. Copy the contents below to the file or click hereto download the file.
    Shell
    #!/bin/bash
    
    # Add the download link
    imageDownloadURL="https://db5xszokwvv76.cloudfront.net/uploads/mobile_file/content/88634/boodmo.png"
    
    ##### DO NOT EDIT BELOW CODE #####
    
    imageName="${imageDownloadURL##*/}"
    localImagePath="/Users/$USER/Downloads/$imageName"
    curl $imageDownloadURL -o $localImagePath
    osascript -e 'tell application "Finder" to set desktop picture to POSIX file "'"$localImagePath"'"'
    ret=$?
    if [ $ret == "0" ]; then
    echo "Wallpaper set successfully "
    else
    echo "Operation failed."
    fi
  3. This shell script will download an image from a specified URL and will set it as the desktop wallpaper on a Mac.
  4. Replace "DOWNLOAD_URL" with the actual link from where image is to be downloaded. For example:
    Shell
    imageDownloadURL="https://wallpaperset.com/w/full/f/b/7/87871.jpg"
  5. Follow our guide to upload & publish the Shell script using Scalefusion Dashboard.
  6. Please note that when this script gets executed by the Scalefusion MDM Client app, the following permission will show up on the Mac. This needs to be allowed in order for the Scalefusion MDM Client app to execute it.
    Please note that to use the Shell scripts, the Scalefusion MDM Client Application must be installed on the device(s). Please follow our guide to publish and install the Scalefusion MDM Agent Application.

    Notes:

    1. The scripts and their contents are sourced from various albeit authenticated Apple Developer communities and forums.

    2. Please validate the scripts on a test machine before deploying them on all your managed devices.

    3. Scalefusion has tested these scripts, however, Scalefusion will not be responsible for any loss of data or system malfunction that may arise due to the incorrect usage of these scripts.


Was this article helpful?