Displaying hidden files in Finder

I needed to edit the .htaccess file on my web server in order to force my host 1and1.com to use php5. I was working on my Mac on was frustrated to find that there is no easy way to actually display hidden files through Finder, so although I knew I had downloaded the .htaccess file to my desktop I couldn’t actually easily edit.

Now one could use terminal to navigate to the file, and then edit using a vi or an emacs derivative – or perhaps chmod the file attributes temporarily; but for me personally – I didn’t fancy this approach every time.

A quick internet search yielded this solution:

To turn on hidden files in Finder, open Terminal and execute

defaults write com.apple.finder AppleShowAllFiles TRUE

killall Finder

and to revert back simply use:

defaults write com.apple.finder AppleShowAllFiles FALSE

killall Finder

It is possible to manually edit the Finder preference file to always show hidden files; but I prefer this neater temporary solution.