MacOS – Opt / Private Folder visible on HD

finderfoldersmacos

for some reason my /opt /private folders are not hidden anymore while the rest of my finder's hidden files are. What would cause these to be visible again, and how do I change them back? I know it has something to do with permissions, or fixing it might involve using "chflags"command.

update: so I fixed it after some searching around by using chflags

sudo chflags hidden /opt /private

though Im still curious what caused these files to change. Do you think it would have anything to do with developer tools or SDKs? I recently installed a bunch for mobile testing/development

Best Answer

This little ditty might help...

for ff in '/Network /Volumes /bin /cores  /etc 
  /mach /mach_kernel /private /sbin /tmp /usr /var '
do
   sudo chflags hidden $ff
done

You'll want to add in /opt if you added that and any other non-standard directories in / you wish to hide from the GUI.

As to why - you might need to track that down using fs_usage, but typically it's an installer that brute forces permissions or otherwise removed the metadata flags from those files.