Most of the time it is okay not to see the hidden files of your system. But sometimes you want to. Doing a short web search you will quickly find the solution:
- Open a terminal
- Change the variable which controls if hidden files are shown:
“defaults write com.apple.finder AppleShowAllFiles TRUE”
- Restart Finder:
While this certainly works, it is inconvenient and the next time you want to “toggle the switch” you will have to do a web search again because you will sure have forgotten the syntax.
Some people on the web came up with the idea to write a shell script to automate the process. This is a good approach and the solution I present here will build on that. However I found that many scripts I spot on the web were not working, so I coded my own one.
My solution is to run the script within an Automator action and to save the Automator workflow as an application. This way you can start the process as easy as starting your browser and if you have a shortcut application like me, you can even fire it up with a keyboard shortcut.
The whole assembling can be done as easy as 1-2-3 in three minutes:
- Open Automator and choose to create an application
- Drag a “Run Shell Script” action onto the workflow and paste in the script from below.
- Save the workflow
The Shell Script:
if [[ $(defaults read com.apple.finder AppleShowAllFiles) == TRUE ]] || [[ $(defaults read com.apple.finder AppleShowAllFiles) == "YES" ]] || [[ $(defaults read com.apple.finder AppleShowAllFiles) == "1" ]] ; then
defaults write com.apple.finder AppleShowAllFiles FALSE
defaults write com.apple.finder AppleShowAllFiles TRUE