Hide Folders in MacOS Finder
A situation I’ve found myself in twice now is wanting to hide a folder in Finder without making it a dotfile, which would also hide it when using ls
. Turns out there is a flag for this. To hide a file from the command line, use chflags hidden
. To show it again, chflags nohidden
.
I was even able to make a shortcut, so that I can right click and hide a folder from Finder itself — which is surprising, because I’ve never had Shortcuts do what I want with anything involving a shell script. The only wrinkle is that you must — I shit you not — go to Settings and give Finder full disk access.
You have to give Finder full disk access.
Finder is located at /System/Library/CoreServices/Finder.app
, so once you go to Finder > Privacy & Security > Full Disk Access, hit the plus button, navigate to that folder, and select Finder.app. After that, the shortcut works as expected. You can download the it here.