14

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?

3 Answers 3

18

To hide:

chflags -h hidden <symlink>

To show again:

chflags -h nohidden <symlink>
2
  • Note that the -h option was only added in Lion. I prefer using chflags, since SetFile only comes with Developer Tools.
    – Eric3
    Commented Apr 25, 2013 at 15:31
  • 1
    -h If the file is a symbolic link, change the mode of the link itself rather than the file to which it points.
    – malhal
    Commented Aug 19, 2017 at 22:57
2

Reading fail.

-P                                # perform action on symlink instead of following it

This flag has strange indenting in SetFile -h, and I must have just ignored it assuming it was related to the -m date flag.

So,

SetFile -P -a V my_symlink
1
  • I got your flag, but it is okay to answer your own question if you find the answer yourself. Just be sure to check the other answers to make sure there isn't one better than your own. No worries. Commented Sep 6, 2011 at 15:43
0

If you use ln -s source_file target_file from a terminal you'll get e.g. /etc -> private/etc shown in the ls -la - but only shown the target_file in the folder.

You must log in to answer this question.