Hiding OS X system directories

Posted on Aug. 22, 2009 by Ben Dickson.

This is an old post from 2009. The content may be outdated or no longer relevant.


This is an old post I wrote, which was originally posted on neverfear.org on Sat, 22nd Aug 2009 7:48:07. Archived here for posterity.


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 (archive.org link) ) 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 (archive.org link) .. although it's a pretty big download, about 1GB), so..

I've also mirrored SetFile here - SetFile.gz (archive.org link)

SETFILECMD="$HOME/Downloads/SetFile"

Oh, if you're seeing a bunch of files with names starting with .

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