Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I work with hidden files all the time, but I like an uncluttered desktop. It would be nice to make files like .DS_Store, and .localized invisible just on the Desktop.

Please note I am already aware of this trusty old terminal standby:

defaults write AppleShowAllFiles TRUE
killall Finder

Setting that flag to FALSE applies to everything in the system. My goal is to make an exception for the Desktop. Any suggestions?

share|improve this question
Do you save files on your desktop, or do you always keep it uncluttered? – Daniel Oct 6 '11 at 21:54
It's generally uncluttered (no files). – Matthew Eppelsheimer Oct 6 '11 at 22:24

Although i'm unsure how to fulfill your exact request, I use this tiny widget which gives 1 button access to hide/show hidden files.

share|improve this answer
Although this doesn't answer my question, it's still handy. Thanks! – Matthew Eppelsheimer Oct 7 '11 at 5:27
link doesn't work anymore. what is the widget called? – mr.musicman Dec 27 '13 at 21:03

My approach to this was to set Finder to generally show invisible files, and then explicitly set the invisible flag on files/folders on the Desktop which match certain criteria (.*, Icon, etc).

But this approach failed, as Finder then consequently not only shows files hidden because they start with a dot, but also those which have the invisible flag in their filesystem entry.

Nevertheless I post this idea to you, maybe it leads you to a solution.

# Set Finder to show all hidden files
# Only needs to be executed one time.
defaults write AppleShowAllFiles ON

# Then explicitly flag certain files on the Desktop as invisible
# Run this at every login or at certain intervals (cron job)
/usr/bin/SetFile -a V ~/Desktop/.* ~/Desktop/Icon ~/Desktop/OtherPatternForHiding
share|improve this answer

This does not answer your very specific question but provides an alternative solution. Assuming you want to have easy and quick access to the hidden files and not have them open all the time, which is not recommended anyway.

Here is a little script that Automates the process down to a single click to Show or Hide. It eliminates:

1-possible problems with hidden files showing all the time

2-opening terminal and typing the show hidden files, command each time.

3-Extremly users friendly.

Install this as application onto your dock for easy and fast access.

-- AppleScript to toggle hidden "." files
-- Submitted by Baltwo on Apple Support Community

    do shell script "defaults read AppleShowAllFiles"
on error
    do shell script "defaults write AppleShowAllFiles 0"
end try

if (do shell script "defaults read AppleShowAllFiles") is equal to "0" then
    do shell script "defaults write AppleShowAllFiles 1"
    do shell script "defaults write AppleShowAllFiles 0"
end if

do shell script "killall Finder"
share|improve this answer

I would suggest trying out TotalFinder. Among many other features, it gives you a shortcut to show/hide invisible files in the Finder, but it does not show invisible files on the Desktop.

It's $18, but you also get tabbed and dual-pane Finder windows, and a Visor-like Finder window that you can pop up from any app.

share|improve this answer
Thanks for the suggestion. But, if an application can do that, isn't there likely a command line interface to exploit? – Matthew Eppelsheimer Oct 7 '11 at 5:26
TotalFinder's option to show hidden files is independent of AppleShowAllFiles, so it doesn't necessarily indicate the same effect could be done via command line — but I certainly hope it can be. – joelseph Oct 7 '11 at 6:18
chflags hidden ~/Desktop/hideme

This makes the file/folder invisible from the Finder and save/open panels. You can use {command}{shift}. to toggle visibility during save/open.

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Welcome to Ask Different! Can you explain what this does? Please give more details than an one-line Terminal command. Please take a look at the FAQs for more info. Thanks. – Nathan Greenstein Oct 7 '11 at 2:42
I just tested this. If you enable Finder's "show all files" setting and run chflags hidden .DS_Store, nothing happens. – Graham Oct 7 '11 at 8:57
I confirm @Graham 's observation, it doesn't work on Mountain Lion. – Kheldar Nov 15 '12 at 11:37

This is admittedly a kludge, but replacing the icons for .localized and .DS_Store with a transparent .icns file like this one allows you to drag them into a screen location that's marginally less obnoxious, from a clutter perspective. It's still not as good as being able to assert the equivalent of ShowAllFilesExceptHere

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.