Create Shortcut to Show/Hide hidden files in Mac OS X

Unlike Windows, Mac OS X doesn’t offers a GUI based option to show or hide hidden files and folders in Finder. Hence, you need to manually input the commands via Terminal to do this task which isn’t convenient for most users. To make it easier, you can simply make an executable script to perform the necessary commands and easily toggle between the show/hide files option on your Mac.

For those unaware, you can make any file or folder hidden in OS X by renaming it and placing a period (.) in front of its name. This will make that file/folder invisible in the Finder.

Creating a Shortcut to Show/Hide Invisible Files on Mac OS X

Search for “AppleScript Editor” from the top right corner of screen and open the app. Copy the script below and paste it in the editor as shown.

display dialog "Show all files" buttons {"TRUE", "FALSE"}
set result to button returned of result
if result is equal to "TRUE" then
    do shell script "defaults write com.apple.finder AppleShowAllFiles -boolean true"
else
    do shell script "defaults delete com.apple.finder AppleShowAllFiles"
end if
do shell script "killall Finder"

Screen Shot 2014-01-12 at 4.39.34 PM

Then click on ‘Compile’ button, choose File > Save As and give it a name. Make sure to select ‘Application’ as the file format and Save.

2014-01-12_16-43-43

Run the shortcut and it will ask to ‘Show all files’. Click True to show hidden files and False to hide the hidden files in just a click right from your desktop.

2014-01-12_16-46-00

Source: Stack Overflow

Mayur

Mayur Agarwal is the founder and editor-in-chief of WebTrickz. As a Technology enthusiast and an Internet addict, he loves sharing useful How To’s and Tips & Tricks. Follow him @mayurjango on Twitter where he is extremely active.

Leave a Reply

Your email address will not be published. Required fields are marked *