Easily hiding files in Mac OS X Finder


I like my home folder neat at clean, at least when viewed in finder, and once in a while some application comes along and thinks it has to place some random folder there. In some cases, said application is intelligent enough to prepend the folder with a dot, which will cause it to be hidden in Finder automatically, but here is a way to hide a folder if you cannot change its name:

# Hides a folder in Finder
$ chflags hidden SomeFolder/

# Unhides a folder in Finder
$ chflags nohidden SomeFolder

Because those are somewhat long, I’ve created the following aliases on my system:

alias hide='chflags hidden'
alias unhide='chflags nohidden'

If you add these to lines to your ~/.profile file, you can use hide and unhide as shortcuts.