Hidden Files in Mac OS X
There are three reasons why the Finder may not show a file:
- The file starts with a dot, like .DS_Store.
- The filename is listed in the /.hidden file.
- The HFS+ (in)visibility bit is set.
On Unix, it is convention that files starting with a dot (".") are hidden. ls -a in a terminal displays them.
Mac OS X up till 10.3, had a file /.hidden which contained filenames of a few special files (like the kernel files), that were hidden by the Finder. Newer version of Mac OS X don't install this .hidden file anymore.
All files on HFS+ filesystems contain metadata, including a few special bits. The GetFileInfo and SetFile application, as installed by the Apple Developer Tools reveal those bits. Of these, the (in)visibility bit signifies that a files is hidden:
% GetFileInfo /mach_kernel attributes: aVbstclinmedz
The capital V signifies that this file (the OS kernel) is hidden. To change the visibility bit, use SetFile:
% SetFile -a V ~/Library % SetFile -a v ~/Library
To respectively hide and show the Library folder.
Note that the Finder does not immediately register changes made with SetFile, and will continue to show or hide the file for a while even if it was changed.
If this really bothers you, you can use AppleScript to tell the Finder to update now:
tell application "Finder" tell front window update every item with necessity end tell end tell
As explained on this thread: Mac OSX Finder Refresh.