Skip to content

Instantly share code, notes, and snippets.

@greylabel
Created March 27, 2012 20:09
Show Gist options
  • Save greylabel/2219829 to your computer and use it in GitHub Desktop.
Save greylabel/2219829 to your computer and use it in GitHub Desktop.
Shell script to toggle visibility of .hidden in the Mac OS X Finder
#!/bin/sh
# based on: http://www.brooksandrus.com/blog/2007/03/23/mac-os-x-show-hide-hidden-files-in-finder/
# check if hidden files are visible and store result in a variable
isVisible="$(defaults read com.apple.finder AppleShowAllFiles)"
# toggle visibility based on variables value
if [ "$isVisible" = false ]
then
defaults write com.apple.finder AppleShowAllFiles true
else
defaults write com.apple.finder AppleShowAllFiles false
fi
# force changes by restarting Finder
killall Finder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment