How to Clean Up and Hide Desktop Icons in OS X
Many Mac users view their desktop as a catch-all repository for their files, documents, and projects. The desktop is also where OS X displays connected hard drives, network folders, and disk images, making it a potentially disorganized mess in many instances.
We won’t get into the merits of proper file and folder organization, but even users for whom a messy desktop is acceptable may occasionally want to clear their desktop of all this clutter so that they can focus clearly on a new task or present a tidy backdrop for screencasts. You can always clear your desktop by manually moving files and folders to another location on your Mac’s hard drive, but a quicker and easier way is to temporarily hide desktop items with a quick Terminal command. Here’s how to hide desktop icons in OS X.
First, launch Terminal (located in the Applications > Utilities folder). Then copy and paste the following command and press Return to execute it:
defaults write com.apple.finder CreateDesktop false; killall Finder
This preference disables OS X’s ability to draw desktop icons, and you’ll notice that all of your files, folders, and drives have suddenly disappeared. But don’t worry! They’re not deleted, just hidden.
To demonstrate this, open a Finder window and navigate to your user’s desktop folder. You’ll see that all of your files are still fine and dandy. OS X is simply declining to show them on the desktop. In fact, while this command is enabled, you can continue to store, retrieve, and use files on your desktop without issue. You’ll simply need to do so via a Finder window instead of the desktop itself.
When you’re ready to restore your desktop icons, head back to Terminal and use this command instead:
defaults write com.apple.finder CreateDesktop true; killall Finder
This allows OS X to draw desktop icons once again, and you’ll see all your icons reappear as quickly as they disappeared. This Terminal command to hide desktop icons survives a reboot, but not an OS X upgrade, so you’ll need to reenable the command if you update to a new version of OS X.
If you frequently need to hide desktop icons for things like screenshots and screencasts, you may want to consider third party software such as Desktop Curtain, which offers more advanced functionality such as the ability to use a custom backdrop or hide all but a single application. But if you just need a clean desktop in a pinch, the Terminal command discussed here should do the trick.