A few months ago I started to mess around with a .htaccess file in connection with one of my websites. When I transferred the file from my web server to my desktop via FTP, the file never showed up. I tried again and again, but that dang file would never show up.
After a little searching, I realized that .htaccess is one of the files that OS X hides by default so that you don’t accidentally delete and/or alter it. However, there are times that you need access to those files. Unfortunately Apple hasn’t made it as simple as toggling a menu item in Finder. Instead, you’re going to to have to write out a line or two of code. But if you follow the following few steps, you’ll be able to use Automator to create a plugin that you can use to toggle the view of hidden files from within Finder.
Step 1: Automator Actions
After opening Automator, select Automator from within the Applications Library on the left-hand side. You’ll now see a number of different built-in actions that are available to the Automator application.
Select Run Shell Script from the list of available actions, and drag it into your workflow.
Type (or paste in) the following code into the Run Shell Script text box:
defaults write com.apple.finder AppleShowAllFiles TRUE
Step 2: Save As Plugin
Now that your Automator workflow is finished (yes, that’s it), choose File > Save As Plugin… and choose Finder as the Application. Save your plugin-in as ShowHiddenFiles or something else descriptive.
Now, from the Finder or desktop, simply right-click (or cmd-click) and the contextual menu will appear. Choose Automator > ShowHiddenFiles and the Finder will restart showing all your hidden files.
Step 3: Repeat
Seeing all those hidden files can start to be annoying and can lead to some unfortunate accidents if you happen to delete something you shouldn’t. So as soon as you’re done with the hidden files, simply edit the above workflow by substituting “FALSE” for “TRUE” and save the new plug-in as HideHiddenFile.
Now showing and hiding system files is as easy as a click away.