Show or hide hidden files using a service made in Automator.
Instead of opening the terminal one can instead make an Automator script to turn on or off hidden files on the Mac. I will then show how to create a shortcut in the Finder -> Services menu.
NB! Do also look below the video at my written instructions.
Go to applications and open the Automator.
Select Service. Then click the Choose button.
From the left:
Under Library -> Select Utilities
To the right of Utilities: select Run Shell Script and also drag it to the empty window on the right.
Below the record button top right:
Service receives drop down select no input (bottom of drop down list) and select in the next drop down in Finder.
The Run Shell Script section is seen the window on the right add the following code into it.
status=`defaults read com.apple.finder AppleShowAllFiles`
if [ $status == true ];
defaults write com.apple.finder AppleShowAllFiles false
defaults write com.apple.finder AppleShowAllFiles true
Save the file. I called min Show Hide hidden files.
To use the script click the desktop and go to the Finder menu -> select Services -> name of show-hide file.
Finder will refresh and show the hidden files. Turn on or off hidden files by selecting the Services and show-hide file.
NB! If you get an error with the above code. Use the following code instead:
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
defaults write com.apple.finder AppleShowAllFiles -bool TRUE
osascript -e ‘tell application “Finder” to activate’
Automator Services script location
The Automator script we just created is located in:
Go to your hard drive -> user name -> Library -> Services -> and there you will see the Services Automator script.
NB! You might not see the Library folder. So go to the top Mac menu and select Go and hold down the alt key to make the Library folder seen in the Go menu. While holding down the alt/option key select Library in the Go menu. In The Library folder look for the Services folder and there you will see the Services Automator script. Double click to open the script in Automator.
Creating a shortcut
Go to System Preferences -> Keyboard -> Shortcuts -> Services and find the Services you made showing hidden files. There might be a shortcut there if so test it out. If there is not shortcut there then add shift+cmd+. (period) as the shortcut.
To show hidden files use the shortcut: shift+cmd+. (period).
To hide the files use the same shortcut again.
Using terminal to show or hide hidden files
The classic way to show and hide hidden files is to open terminal.
Applications -> Utilities -> Terminal
defaults write com.apple.finder AppleShowAllFiles TRUE
defaults write com.apple.finder AppleShowAllFiles FALSE
Software to show or hide hidden files.