A Better Way To Show/Hide Hidden Files on Mac OS X

Jun 03, 2016


There are many ways to show/hide hidden files on Mac OS X Mavericks, Yosemite & El Capitan but this is likely the best approach to making switching easy.


Please Note: Since first writing this I have found a better/easier way to hide and (big bonus!) securely encrypt files on Mac OS X – a small, well-built, easy to use and very affordable app called Hider 2. Encryption is a great addition – if you are going to the trouble of hiding something it makes sense to encrypt it. That feature, and the great user interface, make the small price very worthwhile.



If you are a Mac user it's not likely but you may have run into a situation where you want to show hidden files. If you admin a Mac OS X server, especially a Mac OS X web server, you have almost certainly needed to show hidden files.

In either case leaving the files unhidden creates problems. If you are just a Mac user you almost certainly don't want all those hidden files cluttering things up all the time, meaning you will want to hide them again. If you are administering a Mac server it's less of an issue, unless you use Dropbox.

If you do you have likely noticed that leaving hidden files shown seems to confuse Dropbox – syncs never complete. Hide the hidden files again and everything goes back to normal – the sync completes just as it should.

That means that you likely need to flip back and forth between showing and hiding hidden files. If for example you want to make a quick edit to a .htaccess file you need to first show hidden files, then make the change, then hide hidden files again to avoid the problem with Dropbox.

Traditionally this is done with the terminal app. The following steps show hidden files:


defaults write com.apple.finder AppleShowAllFiles YES

killall Finder


The first line tells OS X to show all files, including the hidden ones. The second line restarts the Finder, which is essential for the change to take effect. If you are looking at the desktop you first notice that al icons disappear as the Finder restarts, then all the icons (plus those formerly hidden) reappear.

The steps to then hide the hidden files again look like this:


defaults write com.apple.finder AppleShowAllFiles NO

killall Finder


This time the first step tells OS X to go back to hiding hidden files and again the second step restarts the Finder, forcing the change to take effect. Again all icons will briefly disappear but this time only the normally visible files will reappear. It's a little bit of work.

An easier option is to create an Automator script that toggles back and forth between showing/hiding hidden files. You can then just leave an alias to the script on your desktop, and clicking it flips you back and forth between showing/hiding hidden files.



A Better Way To Show Hidden Files

But this might be the best way of all to flip back and forth. It takes a little bit of work in Terminal to set up. Not everyone is comfortable or completely at home in Terminal but they are likely more familiar with it than with Automator, so fumbling around in Terminal for a couple of minutes is probably easier than learning Automator.


Quickly Show/Hide Hidden Files on Mac OS X Mavericks, Yosemite & El Capitan


The end result is that you simply need to enter showFiles or hideFiles (case sensitive!) into Terminal to change the view. A little more work than just clicking on an Automator script but it feels more intuitive, at least to me.



An Easier Way To Hide (And Encrypt!) Files

If the approaches above seem a little daunting, or you're not comfortable messing around with Terminal, or (best reason yet) you realize that a file worth hiding is a file worth encrypting check out the app Hider 2.

Related Content

Apple Remote Desktop: Fix "Authentication failed to" Error

Using ARD (Apple Remote Desktop) and getting an "Authentication failed to" error in Mac OS X? There is a very easy fix for Sierra, El Capitan & Yosemite.

Showing Hidden Files vs Hiding Regular Files in Mac OS X

They might seem like flip sides of the same coin but the techniques used to show hidden files on a Mac are not the best solution for securely hiding files.

Make Alerts Like "gamed wants to connect to..." Go Away

Instructions for how to disable OS X service you don't need to cut down on Little Snitch alerts like "gamed wants to connect to static.gc.apple"

Cron Web Application/Services Development

A collaborator has founded Cron to provide web application/services & API development along with systems integration and DevOps release management.

Rumpus – Awesome FTP Server For Mac and Windows

The easy way to run an FTP and Web file transfer server that lets clients effortlessly upload/download files using an FTP client or Web browser.

Short Guide to (Finding, Sharing, etc.) SSH Keys on Mac OS X

A short guide to SSH keys and Mac OS X: How to create, find, share and add SSH Keys (and deal with related SSH errors and warnings) on Mac OS X.

Mac OS X Server, Little Snitch & Carbon Copy Cloner

How to avoid losing remote (ARD/SSH) access when booting from a Mac OS X Server volume created by Carbon Copy Cloner and running Little Snitch.

Running Apache Alongside FileMaker Server 13

If you are interested in the tricky configuration required to run FileMaker Server 13 and the standard Apache server on OS X Mavericks server this may help.

Category List

Tag List

Tag Cloud