Skip to content

Instantly share code, notes, and snippets.

@jasonsturges
Created September 10, 2014 17:39
Show Gist options
  • Save jasonsturges/0b9d05fecfe5d3c60769 to your computer and use it in GitHub Desktop.
Save jasonsturges/0b9d05fecfe5d3c60769 to your computer and use it in GitHub Desktop.
Toggle hidden files Automator script for Mac OS X

To start, open up Automator (in the Applications folder) and choose a Service template. From the library choose "Run Shell Script" and drag it across to the workflow area. In the text box paste the following command:

STATUS=`defaults read com.apple.finder AppleShowAllFiles`
if [ $STATUS == YES ]; 
then
    defaults write com.apple.finder AppleShowAllFiles NO
else
    defaults write com.apple.finder AppleShowAllFiles YES
fi
killall Finder

Finally, change the "text" drop-down menu to “no input” and then save you workflow as “Toggle Hidden Files”.

Now if you go to the Finder menu and look under Services, you should find a “Toggle Hidden Files” option. To add the keyboard shortcut, go to the Keyboard section of System Preferences and click the Keyboard shortcuts tab. Select Services from the list on the left, then scroll down to the bottom of the list on the right to find “Toggle Hidden Files”. Double-click on the area to the right of it, then press the keyboard shortcut you want. I used Command-Shift-. (dot).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment