Show hidden files on OS X except .DS_Store

62

22

I want to see all hidden files on my Mac except .DS_Store. Is there a way to do that?

Alan

Posted 2009-08-28T19:39:16.160

Reputation: 889

Answers

26

You can show hidden files in Finder with a simple Terminal command:

defaults write com.apple.finder AppleShowAllFiles -bool YES

Then relaunch Finder by holding down the option key and right-clicking its dock icon.

However, you can't hide the .DS_Store files without hiding the rest of the hidden files. You probably just have to live one way or the other.

jtbandes

Posted 2009-08-28T19:39:16.160

Reputation: 8 350

About "seeing" .DS_Store files, there is a switch to stop creating such files on network folders, and would be strongly advised if you happen to work in an env that is PC-oriented, and not Mac. I was brought before the Prj Mgr (apple Watch slapped) because someone noticed I had been using my Mac, depositing .DS_Store about the project share. You could turn creation of this file off, for some cases - check on it, I know you can for network drives -, and never see them! You could also create a folder action to do almost anything with those files, move and sym-link back, or just rm -f 'em. – Billy McCloskey – 2016-07-17T23:00:08.620

Why is this marked as the correct answer and have 25 upvotes if it doesn't answer OP's question? – octohedron – 2016-10-19T07:19:11.910

Things were much looser back in '09... – jtbandes – 2016-10-19T07:19:59.340

2It doesn't work any more on Mac OS X 10.9 Mavericks:( – Dmitry – 2013-10-28T07:26:51.403

3@Altaveron - Just change YES to TRUE, ie.

sudo defaults write com.apple.finder AppleShowAllFiles TRUE – CourtDemone – 2013-11-13T20:52:05.037

Doesn't help but because of issue with if section before the code. – Dmitry – 2013-11-14T00:22:11.303

3just confirming from os x 10.10 Yosemite this still works.. with YES/NO. – gorelative – 2014-06-10T20:07:52.103

34

This is what Adobe suggests:

To avoid creating .DS_Store files, do not to use the OS X Finder to view folders. An alternative way to view folders is to use UNIX command line.

Brilliant! ;)

user123444555621

Posted 2009-08-28T19:39:16.160

Reputation: 513

13Thanks Adobe, perfect solution. In fact you can just boot your mac straight into shell, everything is much faster. I'm writing this using Lynx browser, it has taken me half an hour. – timhc22 – 2015-04-24T15:01:11.757

38Those Adobe folks are always so helpful. – Alan – 2010-07-12T15:34:57.507

@gorelative because it is pretty funny ;-) – John Smith – 2017-02-27T10:08:53.027

2How does this help with the Desktop issue? You will always be looking at the Desktop through Finder... Right? – rcd – 2014-05-25T17:07:32.760

9im sorry but i dont understand how this is such a highly upvoted answer. "in order to not get .ds_store, don't use a critical piece of your os" – gorelative – 2014-06-10T20:07:22.727

8

@gorelative You may find an explanation here

– user123444555621 – 2014-06-10T23:47:43.280

25

You can't hide it, but you can make it transparent, then drag it to the bottom-left or bottom right corner. So only you will see a string ".DS_Store", and there will be no icon.

Expert method: Copy a transparent image from your favorite img editor, select the icon of the file in the file info window, and paste the transparent image when the original icon is selected on the top.

Step-By-Step method (Previous to Yosemite):

  • Find a pure-white area in a folder, then press Shift-Command-Control-4, and drag out a square. Release the mouse when done, and the white area is now on your clipboard.
  • Open Preview and press Command-V.
  • Click and hold on the Select button in Preview's toolbar, and Instant Alpha from the drop-down menu.
  • Click and drag across the white area until you see the displayed value reach 100%, then press Return.
  • Copy the selected area (Command-C).
  • On the desktop, select your new folder and press Command-I (File » Get Info).
  • (Press Tab once in the Get Info window to) highlight the default icon.
  • Paste the transparent icon from your clipboard into the default icon (Command-V).

Per @mliqu: In OS X Yosemite (10.10.1):

  • Press Shift-Command-Control-4, and drag out a square over any area. Release the mouse when done, and the area is now on your clipboard.
  • Open Preview and press Command-N to open a window with your capture.
  • Press Command-A to select all, then press Delete.
  • Press Command-C to copy this empty grey square to clipboard.
  • Select ".DS_Store" and Command-I to get info.
  • Select the icon in the top-left and Command-V to replace with transparency from clipboard.

frzsombor

Posted 2009-08-28T19:39:16.160

Reputation: 261

There's an easier step-by-step in this answer: http://apple.stackexchange.com/a/237999/6902

– Clay Bridges – 2016-07-17T21:45:33.167

3Not useful in list view, column view, or when keeping items sorted. Also requires changes to every directory's layout. – Daniel Beck – 2012-01-14T23:49:42.017

2Works perfect if desktop is all you care about (like me). Also, if you use the pattern of the desktop instead of transparency then you can push the text out of sight - making the entire icon disappear without a trace. – bendytree – 2012-07-19T14:05:41.320

2For me too, it was a desktop annoyance… – Robert C Edwards – 2013-10-23T18:27:49.020

Good method. Though, it seems temporary sometimes (at least in Mavericks); I see it often change back to an image icon (e.g., PNG or whatever the original format for the transparent image was). – rcd – 2014-05-25T17:06:50.677

12

I'm just adding my solution to this as I didn't like any of the other options. I am a web developer and I use /bin/zsh and oh-my-zsh ... either way you can add this to bash or sh.

It's simple, straight forward, and only 8 lines. I work a lot in the terminal though, so this is why this works best for my setup.

In my .zshrc I added the following lines to make switching easier.

function hideallfiles(){
    defaults write com.apple.finder AppleShowAllFiles -bool NO
    killall Finder
}
function showallfiles(){
    defaults write com.apple.finder AppleShowAllFiles -bool YES
    killall Finder
}

Then run . ~/.zshrc or for bash . ~/.bash_profile or logout of your Mac, and back in.

Then in terminal you can run showallfiles or hideallfiles and it'll change the config and restart Finder.

edit: confirmed working on 10.10 Yosemite

gorelative

Posted 2009-08-28T19:39:16.160

Reputation: 368

works with 10.11 El Capitan too. – Asaf Katz – 2015-10-04T02:37:46.693

8

As of macOS Sierra Beta, .DS_Store is actually always hidden from the Finder. Just show hidden files as you would normally and .DS_Store will be gone:

defaults write com.apple.finder AppleShowAllFiles -bool YES && killall Finder

Matt

Posted 2009-08-28T19:39:16.160

Reputation: 181

Confirmed that in released macOS Sierra (10.12.3), I no longer see .DS_Store in Finder or on the Desktop, which is great. – Michael Liquori – 2017-02-23T16:14:56.647

8

There is this open source magic tool: asepsis. Sources are available on Github.

Version 1.4 now works with OS X Mavericks.

Update: Reported not working on El Capitan

Warning: Asepsis is no longer under active development and supported under OS X 10.11 (El Capitan) and later.

GabLeRoux

Posted 2009-08-28T19:39:16.160

Reputation: 318

1not supported in OS X El Capitan.. ): – Asaf Katz – 2015-10-04T02:36:53.917

@treeflute FWIW it now does if you turn off SIP: http://asepsis.binaryage.com/#sip

– Ryan Brodie – 2015-12-16T00:34:00.420

1This seems like a good app. However the one issue I did note was that if you move entire folders, the matching DS_Store files will not be updated (something about this functionality being not possible due to the indexing design); this could lead to less-than-ideal indexing results. – rcd – 2014-05-25T17:09:24.930

4

After many on/off years of searching for a solution, there are only a few alternatives, none of which quite match your original question; i.e. no solution exists to your specific question....yet

  1. One can specifically disable the .DS_store files from being created at all
  2. Leave Finder configured to not display hidden files
  3. Follow Adobe's nonsense and only browse folders with a command line shell
  4. Toggle hidden folders on-demand. Check out this old wigit:

http://mac.softpedia.com/get/Dashboard-Widgets/Webcams/Miscellaneous/Hiddenfiles-Widget.shtml

Sean C

Posted 2009-08-28T19:39:16.160

Reputation: 101

3

This only addresses the Desktop, but as it's the most noticable and annoying place for .DS_Store files, it might be worth sharing:

  1. Drop to a terminal prompt
  2. cd ~/Desktop
  3. rm .DS_Store
  4. cd ~
  5. chmod 500 Desktop

This sequence removes your write permissions to the Desktop folder. Since Finder acts with your permissions, it also remove's Finder's ability to save a .DS_Store file to the Desktop. Of course, it also stops you from saving to or modifying existing files on the desktop. Perfect if you like to have an ultra-clean setup.

Example of no .DS_Store on the Desktop without using special Apps:

Example OSX desktop with hidden icons shown and no icons on the desktop


note: Using these steps, it is still possible to drag items to the desktop as MacOS will prompt you for an admin login when needed.

joshfindit

Posted 2009-08-28T19:39:16.160

Reputation: 153

2

Create an AppleScript/terminal service using Automator and save it to be accessible from the Finder>Services menu

The Automator action will be a two step process.

Step 1. Add an AppleScript. This script will toggle hidden files on or off (may not be properly formatted because I'm typing on my phone)

if (do shell script "defaults read com.apple.finder AppleShowAllFiles") is equal to "0"
    then
        do shell script "defaults write com.apple.finder AppleShowAllFiles 1"
    else
        do shell script "defaults write com.apple.finder AppleShowAllFiles 0"
end if

Step 2. Add a bash cron script. This additional script will automatically search for and remove any .DS_Store files at the same time they would be triggered to display. Once completed it will relaunch Finder and close the terminal.

#!/bin/sh
find ~ -name .DS_Store -exec /bin/rm -f -- {} \;
KillAll Finder
exit 0

This is not a perfect solution but it will achieve the result your looking for.

Alternatively, you could use this utility which will redirect the creation of DS_Store files to a cache directory but I prefer not to install software that will consume resources whenever possible.

The link is http://asepsis.binaryage.com/

davidcondrey

Posted 2009-08-28T19:39:16.160

Reputation: 1 345

To prevent DS_Store files from being created on network volumes run this in terminal for each user on your computer. defaults write com.apple.desktopservices DSDontWriteNetworkStores true – davidcondrey – 2014-01-20T04:07:19.250

1

Install latest Sierra, set to see hidden files, all hiden files shown, but the .DS_Store files will not be shown (although they are there).

LexS user87973

Posted 2009-08-28T19:39:16.160

Reputation: 151

1

Using Terminal works to hide .DS_store files.

defaults write com.apple.finder AppleShowAllFiles -bool NO

This hides the hidden files. Can change NO to YES if you wish to see them again.

MACUSEROLI

Posted 2009-08-28T19:39:16.160

Reputation: 19

1

I'm using Xtra Finder (http://www.trankynam.com/xtrafinder) to toogle fast between hidden files. You can create your own shortcut for toogling. No need to kill finder. This is a little bit more handy and easier to use instead of typing commands or executing scripts.

user334355

Posted 2009-08-28T19:39:16.160

Reputation: 11

1

For the desktop annoying problem, my simple solution is hide the file behind the dock, you can change momentary the dock position and put the file where will remain invisible. Not a very technical solution, but effective.

Edu

Posted 2009-08-28T19:39:16.160

Reputation: 11

0

El Capitan user here.

I like to keep an clean desktop; no icons or links at all. I also need to see hidden files in Finder.

I "double clicked" the .DS_Store Icon and selected "Show View Options." In that window, I scaled the icon down to 16x16, and text size to 10. I set the Grid Size as small as possible as well.

I then dragged the icon down to the lower right, so I'm left with a tiny box in the lower right corner of the Desktop.

ExLinuxDux

Posted 2009-08-28T19:39:16.160

Reputation: 9

0

Transparent icon, move off screen, easy step-by-step here:

https://www.scottofford.com/2013/03/hide-ds-store-on-mac/

Via this Ask Different answer: https://apple.stackexchange.com/a/237999/6902.

Clay Bridges

Posted 2009-08-28T19:39:16.160

Reputation: 129

0

Definitely use the transparent icon. Then, just move it. Out of sight, out of mind.

https://cldup.com/YkQMi3mfUL.gif

Kevin Suttle

Posted 2009-08-28T19:39:16.160

Reputation: 157