Apple - How to permanently unhide the Users Library folder in Catalina
There's a visible pref for it, no need to dig in
This is simplest if you use Icon or List view*
Open to your User's Home folder -
/users/[yourname]/ - then either View Menu > Show View Options or Cmd ⌘ J
Check the box for Show Library Folder.
*This is just because in Column view you're less certain exactly which folder you are affecting. The Show Library option only appears when you're in exactly the right folder.
On the command line it's:
chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library
No need to kill Finder.app!
Both commands (
chflags ... &
xattr ...) remove a "hide flag" here. Especially the second command - the first one is well known already - removes the extended attribute com.apple.FinderInfo of the user's Library folder with the content:
0000000000000000400000000000000000000000000000000000000000000000 which - when applied like this - hides files and folders immediately.
In return you can hide files and folders by applying:
xattr -wx com.apple.FinderInfo "0000000000000000400000000000000000000000000000000000000000000000" foo.bar
If the file or folder already has an extended attribute com.apple.FinderInfo (e.g. a single color tag) it will be overwritten.
Apparently you can combine tags/flags in com.apple.FinderInfo and:
xattr -wx com.apple.FinderInfo "0000000000000000400400000000000000000000000000000000000000000000" foo.bar
will hide the file and apply a green tag.