Hiding OS X system directories

ben
Fri, 21 Aug 2009 22:18:07 +0000

After restoring a backup, the various OS X system folders became visible again (such as /bin /mach_kernel etc)

The following command (adapted from this post by Wowzera) will hide them again:

# Hide sym-links
SETFILECMD="/Developer/Tools/SetFile"
for cdir in /etc /tmp /var;
    do sudo $SETFILECMD -P -a V $cdir;
done

# Hide directories
for cdir in /bin /cores /mach_kernel /private /sbin /usr /Volumes; do
    sudo $SETFILECMD -a V $cdir;
done

Launch Terminal (in Applications, then Utilities), and paste the above script.

You'll need the Developer Tools installed - they are on the OS X installer disc, or you can get them from the Apple Developer Connection site.. although it's a pretty big download, about 1GB), so..

I've also mirrored SetFile here - SetFile.gz - download that, extract it (just double click it), and change the SETFILECMD="/Developer/Tools/SetFile"to point to the new file - for example, if it's in your "Downloads" folder:

SETFILECMD="$HOME/Downloads/SetFile"

Oh, if you're seeing a bunch of files with names starting with . - hidden files, there's a different solution:

defaults write com.apple.finder AppleShowAllFiles -boolean false
killall Finder