MacOS – How does Finder decide if a file should be hidden

findermacos

There are quite a few files/direcotries under /. But Finder only shows 'System', 'Library', 'Users' and 'Applications'.

I create a directory called /mnt, and Finder shows it. Why? What is the difference between /mnt and other directories like /bin or /usr that makes it shown in Finder? Or how can I make /mnt hidden and make /bin shown?

Best Answer

I found the answer! It is controlled by the hidden flag. Open Terminal,

$ /bin/ls -Ol

will show you which files are flagged with hidden.

To make /mnt hidden, simply

$ sudo chflags hidden /mnt

To change back

$ sudo chflags nohidden /mnt

Cheers!