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


I have a strange and recurring problem on my recently upgraded Mac running macOS Catalina

First of all, Catalina has a new feature where you can Show/hide the hidden files on your machine using Cmd-Shift-Period. Press it once to show the hidden files press it again to hide them. AFAIK, this specific keystroke feature is new in Catalina (prior to Catalina, I always used the hack to set the finder defaults via the terminal to see my hidden files).

I normally keep my Finder windows showing the hidden files, because I want to see them.

Recently I noticed that all of my files on the desktop were greyed out– like hidden. They were just random files I happened to have left on my desktop.

And what's strange is that they don't begin with a period (.), the way normal hidden files do. They seem to behave as hidden files even though they don't begin with a period.

If I press Cmd-Shift-Period, they disappear from view like all of the other hidden files. But unlike the other hidden files, they aren't supposed to be hidden.

enter image description here

If I press Cmd-Shift-Period again, they appear along with the other hidden files in my finder windows

enter image description here

Just to be clear: these files were NOT hidden yesterday, and I didn't do anything that I know of to cause this. And as noted below, it doesn't happen right away when I put new files on the desktop. I noticed it last week too but now it seems to have done it to even more files that I put on the desktop more recently than when I first noticed it (The same behavior– Finder seems like it took some visible files and turned them into these invisible files without changing the file names or adding pre-pending periods like you'd expect for invisible files.)

1) I'm not sure what is causing this. What could be causing these files to appear in this hidden state and to have been normal files and then somehow get morphed into this hidden state?

2) How can i fix them? I've never seen hidden files like these– I've only ever seen hidden files that begin with periods (so with this, you can add or remove the period to change its visibility)— if I do "Get Info" on these hidden files I can see the normal Get Info window, which has options for many things like "Hide extension" but no option to set the file to visibile/hidden.

Was this a new feature introduced in Catalina?

When I create new files on the desktop, the new files are not hidden and behave normally:

enter image description here

Best Answer

We resolved it in the comments as following:

  • Give full disk access to Terminal in System Preferences > Privacy & Security.
  • Run

    cd ~/Desktop
    chflags -R nohidden ./
    killall Finder

    The -R flag will unhide recursively everything under the ./ (current directory).

  • To hide something back, for example:

    chflags hidden ~/Desktop/project/.git

    Don't use -R here since git only keeps the top level folder, .git hidden, rest all inside it is normal.