Unlike Windows, the Mac operating system does not make it easy to view the hidden files on your computer. Apple does this for our own safety since messing with hidden files can get ugly, but in certain cases it still needs to be done.
Although just about anybody could need to at some point, web developers are probably the most common group of people who work with hidden files on a regular basis. For example, the other day I needed to edit a .htaccess file on my server and couldn’t find where it went after downloading it to my desktop. I knew it was there, but since the filename starts with a dot (“.”) Mac OS X is set to hide it by default. Generally this behavior is a good thing, but not in this particular instance.
Running a command in Terminal is the most basic way to show hidden files on a Mac. While that method works fine, it sure is a pain to remember the code every time you want to toggle it on or off. Instead, we’re going to utilize the power of Automator (which is built into Mac OS X) to create a Finder plug-in that can be easily accessed at any time. Please note this method does not work in 10.6 Snow Leopard.
- Coincidentally, the first step is to launch Automator from the Applications folder. If you’ve never used this program before, don’t worry. It’s extremely confusing to newcomers (myself included), but our task for this tutorial is very simple.
- On the left side you should see a list of Actions in the library. Choose Utilities and then double-click Run Shell Script in the next column (or drag it to the workflow area).
- Type the following code into the text box. I wouldn’t recommend copying and pasting directly because the apostrophes & quotes have a tendency to get screwed up.
defaults write com.apple.finder AppleShowAllFiles TRUE
osascript -e ‘tell application “Finder” to quit’;
osascript -e ‘tell application “Finder” to activate’;
- In the menu bar, go to File > Save As Plug-In. Type in a name like “Show Hidden Files” and click the Save button.
- Since it’s not a good idea to leave hidden files turned on all the time, we also need to create a plug-in which brings things back to normal. Keeping the same command as before, simply change TRUE to FALSE in the workflow and go to File > Save As Plug-In again. This time name it “Hide Hidden Files” and click Save.
Our work in Automator is complete and now it’s time to enjoy the fruits of our labor — all 3 minutes of it. Right-click anywhere on your desktop or in a Finder window. In the popup menu that displays, go to More > Automator > Show Hidden Files. There they are! All your hidden files should now be visible. When you no longer have a need to see them, right-click again and this time choose Hide Hidden Files from the menu.
Oh, and there is one last thing… (sorry, I had to say it). It’s easy to remove these plug-ins from your system by going to Users/[username]/Library/Workflows/Applications/Finder and dragging the two files to the Trash.