Hide Desktop Icons For Screen Recordings in macOS

Reading an IconLogic post about hiding desktop icons on a Windows machine has me wondering about how to do the same for macOS.
Doing this is a bit more intimidating than it is in Windows because the quickest way involves using the Terminal. Not to worry, it is actually pretty easy and quick and we will automate it before we finish.

To toggle the icons we will set CreateDesktop false to hide icons and true to show them, then restart Finder to execute the changed setting.

Open Terminal and enter:

defaults write com.apple.finder CreateDesktop false; killall Finder

To restore your desktop:

defaults write com.apple.finder CreateDesktop false; killall Finder

Easy enough but you may not remember that if you don’t do it much so let’s automate it so all you need to do is click.

Automator is a wonderful little hidden gem for doing all sorts of interesting tasks. To automate our terminal command:

  1. Start Automator
  2. Select “Application” and click “Choose”
  3. Under Actions/Utilities from your library select “Run Applescript”
  4. Drag the “Run Applescript” to your pane.
  5. In the code section marked by (* Your script goes here *), add this Applescript Code:
try
set toggle to do shell script "defaults read com.apple.finder CreateDesktop"
if toggle = "true" then
do shell script "defaults write com.apple.finder CreateDesktop false"
else if toggle = "false" then
 do shell script "defaults write com.apple.finder CreateDesktop true"
end if
end try

do shell script "killall Finder"

Save the workflow as something like “Toggle Desktop Icons” and drag the application to the Dock. Now you will be able to just click to turn your desktop icons on and off!