DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Toggle Hidden Files In Mac OS X Finder

07.30.2008
| 6519 views |
  • submit to reddit
        Works in Leopard, should work in all versions of OS X.

#!/bin/bash

if [ `defaults read com.apple.finder AppleShowAllFiles` == 1 ]
then 
  echo "Hiding hidden files."
  defaults write com.apple.finder AppleShowAllFiles -bool false
else 
  echo "Showing hidden files."
  defaults write com.apple.finder AppleShowAllFiles -bool true
fi   
     
KillAll Finder