Happy toast

Show Hidden Files in OS X

  1. macos
  2. scripting

Mac OS X doesn’t show hidden files by default. That’s kind of the point of being a hidden file, after all. But sometimes you want to see them anyway. For example, if you’re looking for a .gitignore file for editing.

I thought this would be a quick fix, maybe a checkbox under System Preferences. Unfortunately, it was a bit more involved than that.

In Terminal

Probably the quickest way to see hidden files is in the terminal. Just run this:

ls -a

If you want to see only hidden files, use this:

ls -ld .??*

In Finder

That’s great and all, but you probably want to see hidden files as you browse in Finder. Back in the terminal, run this command:

defaults write com.apple.Finder AppleShowAllFiles YES

You’ll need to restart Finder to see the change. Hold ALT and right-click on Finder in your dock. Click Relaunch. Now you’re good to go.

In Dialog Boxes

You might think that showing hidden files in Finder carries over to open/save file dialog boxes. Not so. This one’s easy though. With the dialog box open and focused, hit COMMAND+SHIFT+PERIOD. Done.

DS_Store Files Everywhere!

So now that you can see hidden files, you’ll notice something. There are hidden DS_Store files EVERYWHERE. DS_Store files (stands for desktop services store) are harmless little files that hold customization settings for folders in OS X. You can safely delete them… but they’ll keep coming back.

Fortunately, there’s a little utility out there called Asepsis. It doesn’t prevent DS_Store files from being created, but rather keeps them all tucked away in a hidden folder, significantly reducing clutter across your file system.

Asepsis is easy enough to get running. Download, install, reboot. System updates can whack Asepsis though. If that happens, run the following in terminal:

asepsisctl uninstall_wrapper
asepsisctl install_wrapper

Old DS_Store Files Everywhere!

Alright, so you have the DS_Store problem solved… Mostly. Asepsis doesn’t do anything about all the DS_Store files you already had. No worries. Open up your terminal and run this one-time command to purge existing DS_Store files from your system:

sudo find / -name ".DS_Store" -depth -exec rm {} \;


Now you can see things that others can’t. Enjoy your new god-like powers.

Thank you!