chflags nohidden not unhiding hidden files

Solution 1:

Once I copied files via terminal from an iPod to a Mac and somehow they appeared hidden, chflags nohidden <filename> did not work, neither the same command with different option flags. Finally, I found this answer which worked fine. So:

  1. xattr -d com.apple.FinderInfo <filename>
  2. chflags nohidden <filename>
  3. killall Finder (just in case)

I did it using * so I did not have to go one by one. Hope it helps,

Solution 2:

I answered the same question and OP reported that the files got unhidden at first but got hidden later on. Looks like a bug to me.

  • Files on my desktop seem to set themselves as hidden files (macOS Catalina), greyed out, even though they don't begin with periods

It seems you need a recursive flag.

chflags -R nohidden ~/Desktop/folder

Then kill Finder to restart it.

killall Finder

Solution 3:

If it does help, I found what I believe would be a bug. I tried to use recursive mode to unhide files within root and subfolders. As long as I would use only the path to Root folder (Documents) the terminal console output was; No such file or directory

sudo chlfags - R nohidden /Users/user/Documents/

When I copied whole path to the file (use Command+shift+[.] to show hidden files first in Finder), hid or unhid a file within Documents folder, I was also able to just remove the file name from the path and then successfully execute Recursive action to hide/unhide all files and folders within Documents. Is this does look and feel like a bug to me.

Workaround:

chflags - R nohidden  /Users/user/Documents/filename.txt

the file was then visible.

Next step, remove the file name from the path and repeat command, to either hide or unhide.

chflags - R nohidden  /Users/user/Documents/

No need to kill Finder to confirm, just move between folder up or down to refresh the window. It worked for me on Big Sur Mac OS.