Hide/Unhide desktop icons on Mac devices
  • 05 Dec 2023
  • 1 Minute to read
  • PDF

Hide/Unhide desktop icons on Mac devices

  • PDF

Article Summary

The following Shell Script will allow the IT Admins to hide the icons on the desktop on their managed Mac devices. 

  1. Create a file on your desktop, for example, Hide-Desktop-icons.sh and open it in a text editor like notepad++
  2. Copy the contents below to the file or click here to download the file.
    Shell
    #!/bin/bash
    
    # Set the following value to true or false if the icons needs to be shown or hidden
    ShouldShowIconsOnDesktop=false
    
    defaults write com.apple.finder CreateDesktop -bool $ShouldShowIconsOnDesktop && killall Finder
    1. In the script change the ShouldShowIconsOnDesktop to false, to hide the icons. For example,
      Shell
      # Set the following value to true or false if the icons needs to be shown or hidden
      ShouldShowIconsOnDesktop=false

    2. While uploading the script please select Yes for the option "Run script as signed-in user" as shown in the image below.
    3. This script will hide or unhide the icons only for the current logged in user.
    4. This will also block the right click on the desktop to open shortcut menus.
    5. To make the icons visible again and to return the right click to its default function, change the ShouldShowIconsOnDesktop to true. For example,
# Set the following value to true or false if the icons needs to be shown or hidden
ShouldShowIconsOnDesktop=true



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 data loss or system malfunction that may arise due to the incorrect usage of these scripts.






Was this article helpful?