Show hidden files on OS X except .DS_Store

Solution 1:

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.

Solution 2:

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! ;)

Solution 3:

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.

Solution 4:

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

Solution 5:

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