110 Comments

Summary:

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 […]

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.
automator_action1.jpg
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
killall Finder

shell_script_showall.jpg

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.
save_as_plugin.jpg

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.
right-click_showhiddenfiles.jpg

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.

  1. You sure this works?
    I keep getting “Workflow Failed”, so have I missed anything?

    Share
  2. I use an AppleScript called “Show Hide Invisible Files 1.5″ …dead simple.
    J. T. AppleScripts – http://216.127.146.15/~j_gar@trysb.net/

    Share
  3. It works perfectly fine. Vanni: you could use third party software however it takes the fun out of learning the intricacies of your Mac.

    Share
  4. @grness. you are right. i just finished your tutorial and it was indeed fun and informative. thanks!

    Share
  5. or, install MainMenu and have this one click away, along with the handy Repair Disk Permissions

    Share
    1. Main Menu – really simple! =) thanks

      Share
  6. What would be great is if you could apply it to just a single folder, or hierarchy of folders. Specifically, I have Apache installed so I’d like to see all the hidden files in the htdocs folder, but nowhere else. That would be cool.

    Share
  7. I get workflow failed on both as well…

    Share
  8. Adam and James…

    Always check the log when troubleshooting a “Workflow Execution Failed” message. To view the log, select ‘Show Log’ in the ‘View’ menu. If the fix isn’t obvious, post another comment with the log results… maybe we can help.

    Share
  9. I get a workflow failed as well. “An error 2007-05-01 09:20:18.830 defaults[251] Unexpected argument Finder; leaving defaults unchanged. 91) occured in Run Shell”

    Share
  10. Strange, because if I run the commands from the Terminal, they work fine. I’m on OS X 10.4.9 by the way.

    Share

Comments have been disabled for this post