Easily Add a Keyboard Shortcut to Reveal Hidden Files in Mac OS X

In an earlier tutorial, we have shown you how you can reveal the hidden files in Mac OS X, via the terminal. For those who need to access the hidden files frequently, but hate to use the terminal every time to toggle the visibility of the files, how about setting a keyboard shortcut so you can quickly reveal hidden files with a single press of a key?

To make this work, we have to create a service (in Automator) to run the command and then assign a shortcut for this service.

Note: The following method is tested and working on Mac OS X Yosemite. There are a few reports stating that it might not work in 10.8 (OS X Mountain Lion) and below. We have no way to verify that, so if you are using an older version of OS X, follow this at your own risk.

Creating a service to run the reveal hidden files command

In OS X, open Automator (Applications -> Automator). It will prompt you to choose a type for your new automation. Select “Service.”


In the left most pane, select Utilities. In the center pane, select “Run AppleScript,” and drag it to the Workflow area.


In the Workflow area, first select “no input” for the “Service receives” dropdown field. Next, change the all application field to “Finder.”


In the AppleScript section, replace the line (* Your script goes here *) with this:

script credit: Ask Different

Lastly, save this (File -> Save) with the name “ToggleHidden” (or any other name that you desire).


To test if the ToggleHidden service is working, open Finder and go to the menu (Finder -> Services) and select the “ToggleHidden” service.


If it works fine, all the hidden files should show up in the Finder. Click on it again, and the hidden files should disappear.

Assigning keyboard shortcut to ToggleHidden

The last step to complete this tutorial is to assign a keyboard shortcut to this service. Go to “System Preferences -> Keyboard -> Shortcuts.” In the left pane, select “Services.” In the right pane, scroll down until you see the “ToggleHidden” entry.


Select the “ToggleHidden” entry and click the “add shortcut” text. You can now add a keyboard shortcut for this service. For this tutorial, I set “Ctrl + Shift + H.” Just for your info, most Linux distros are using “Ctrl + H” to toggle the visibility of hidden files.

That’s it.


For most users, most of the time there won’t be any need to access the hidden files. But for those who need to, revealing the hidden files via the terminal can be a troublesome task, not to mention that you have to remember the command to do it. Setting a keyboard shortcut for this task will make things much easier and definitely make you more productive.

Let us know in the comments if you have any questions.

Damien Damien

Damien Oh started writing tech articles since 2007 and has over 10 years of experience in the tech industry. He is proficient in Windows, Linux, Mac, Android and iOS, and worked as a part time WordPress Developer. He is currently the owner and Editor-in-Chief of Make Tech Easier.


  1. I’ve been looking for exactly this for a while, but under 10.10.4 I am getting this error message when run:
    “The action “Run AppleScript” encountered an error.”
    Any changes to the script required to run on the latest (& greatest) OSX version…???

  2. Hi,

    First thanks for the great script.
    I had a bit of trouble with it but have solved it by expanding on your “the [&] should be [&] only”.

    To clarify you need to change the line:

    do shell script “defaults write com.apple.finder AppleShowAllFiles ” & newHiddenVisiblesState


    do shell script “defaults write com.apple.finder AppleShowAllFiles ” & newHiddenVisiblesState

    Works just fine :)

    1. Hey!

      Thanks for the script

      I’ve copied and pasted Oliver’s ‘fix’ but I’m still getting an error message.

      Help? :(

Comments are closed.