How to make symbolic links invisible in the Finder

finderterminal

I use SetFile via the terminal to render files and folders invisible inside Finder windows. This does not appear to work on symbolic links: the symlink destination is made invisible, rather than the symlink itself.

I see a number of symlinks in / which are invisible in the Finder (e.g. /etc -> private/etc), so it seems to be possible. Can I duplicate this behavior?

Best Answer

To hide:

chflags -h hidden <symlink>

To show again:

chflags -h nohidden <symlink>