MS Windows: Show Hidden FilesThe Mac is well known as an easy, reliable computer.

It only took me five minutes to discover that Mac marketing hype has its limits.

Administrating a Mac server requires the ability to look at a variety of configuration files, particularly when doing anything beyond the bare basics.

So, one of my first goals was to make it easy to see the “hidden” files on the computer.

It’s easy on Windows. Just open up Tools->Options and change a checkbox or two.

How about on the mac?

Nope, there’s no option for this. It’s not in the user guide. Nowhere. I guess they just assume people don’t need to see hidden files.

So, I searched Google… and found a good set of instructions. Here’s what it takes:

1. Open Automator (in your Applications folder) and choose Service from the list of templates provided and click the Choose button.

2 In the left hand column under Library, select Utilities.

3. In the second column, drag “Run Shell Script” to the right hand pane.

4. At the top of the right hand pane where you dragged the Run Shell Script action, click on the right-hand popup menu and change “any application” to “Finder”. This sets the service so it only appears and can be activated by the keyboard shortcut when Finder is the active application.

5. Then click on the popup menu next to “Service receives” and choose “no input”. It’s important you do this step after step 4 because if you do the reverse, Finder won’t be available as an option in the right hand menu.

6. Copy and paste the following text into the empty text area of the Run Shell Script action:

7.

osascript -e 'tell application "Finder" to quit'
SHOWHIDDEN=`defaults read com.apple.finder AppleShowAllFiles`
if [ $SHOWHIDDEN -eq 1 ]; then
   defaults write com.apple.finder AppleShowAllFiles -bool FALSE
else
   defaults write com.apple.finder AppleShowAllFiles -bool TRUE
fi
osascript -e 'tell application "Finder" to activate'

Completed Automator action, ready to save (click to enlarge)
8. Choose File–>Save, and give the new service a meaningful name like “Toggle Hidden Files” that will appear in the Services menu. Once you’ve done that, you can go to the Services menu (located in the current application menu, next to the Apple menu) and your newly created service should appear there. You can even run it, it’s already functional, just lacking a keyboard shortcut.

9. Open System Preferences–>Keyboard–>Keyboard Shortcuts and select Services in the left column.

10. Setting the keyboard shortcut (click to enlarge)
11. Scroll down to the bottom and under the General category, you should see your newly created service listed there. Select it, then Double-click close to the right side of the selected line to reveal a field where you can enter a custom keyboard shortcut. Enter “Shift+Command+.” (might as well keep it consistent with the shortcut used in open/save dialog boxes), and then quit System Preferences.

The good news: follow those instructions carefully, and you will now be able to view or hide the hidden files. (By pressing Shift, Command and “+” together.)


Update (March 7, 2011): A friend has discovered an easier solution, albeit still non-standard. The built-in Dashboard app supports several thousand user-supplied “widget” mini-apps. One of those apps is the Hidden Files widget. With that widget installed (and the Dashboard icon dragged to your icon bar), toggling hidden file visibility is as simple as firing up the Dashboard, clicking on the Widget, and re-hiding the Dashboard.

Leave a Reply

You must be logged in to post a comment.