Hide Desktop Icons on Mac

Ever wanted to hide your desktop icons briefly and easily on Mac OS X for a presentation, screencast or just to hide everyday clutter? Here’s a simple Bash script you can use.

#!/bin/bash

# checks visibility and stores value in a variable
isVisible="$(defaults read com.apple.finder CreateDesktop)"

# toggle desktop icon visibility based on variable
if [ "$isVisible" = 1 ]; then
	defaults write com.apple.finder CreateDesktop -bool false
else
	defaults write com.apple.finder CreateDesktop -bool true
fi

# force changes by restarting Finder
killall Finder

Paste that into a text editor and save it without a suffix/filetype as something like desktop. Then execute the following command while in the folder where you saved the script (preferably in your personal bin directory): chmod 755 desktop. You should be good to go as long as the directory you saved it in is mapped to your $PATH (If you aren’t sure what that means, read the 4th and 5th paragraphs of Clock In, Clock Out).

You can find some simple apps to do this if you are repelled by the Terminal or love extra menubar buttons; just search Google. Some of them cost money (CamouFlage – $1.99), though I don’t know who would pay for something so simple. There are some other free alternatives.

3 Comments

  1. brilliant.

    Reply

    1. Thank you.

      Reply

Comments, questions and feedback welcome.