A dot file in Mac OS X is any file that has a file name starting with a period. Mac OS X inherited a feature common to Unix that makes these files invisible to you unless steps are taken to reveal them. Technically, you can delete dot files, but most of them store essential information and shouldn't be deleted.
Invisible Files
- The primary reason for an operating system to support invisible files is to allow the computer to store behind-the-scenes information as needed in a way that prevents a casual computer user from deleting these files when they seem unfamiliar. Mac OS X has several methods of creating invisible files, so there are invisible files and folders that aren't also dot files. Invisible files can be revealed in any folder using the Terminal application. Type "ls -a" and a space, drag a folder to the Terminal window, and then press "Return." This will display all files in that folder regardless of their visibility.
Default Dot Files
- All Mac OS X user accounts include dot files by default in their home directories. The ".Trash" folder is where files are stored when you drag them to the trashcan. By placing these files in that invisible folder, Mac OS X treats them differently than files stored anywhere else. The ".DS_Store" file contains additional information about files stored in the same folder and is regularly created in many Mac folders. The folder ".CFUserTextEncoding" stores information about your language preferences. The ".bash_history" folder contains recent commands in the Terminal window and is used only when working with the Unix command line in Mac OS X.
Essential Dot Files
- The ".bash_history" file is the only one of the four default dot files that can be safely deleted, and only if you don't work with the Unix command line. The other three dot files in your home folder store important information or can cause technical problems if software looks for these default items and can't find them. This is the pattern for all dot files. Invisible files are usually hidden for good reason, to prevent accidental modification or deletion.
Handling Dot Files
- There's rarely any reason to delete a dot file. Most of them are very small text files, and the majority of dot files that don't fit this description are large because they're essential. It's safe to delete some of these files because in many cases Mac OS X or an application will create them again as needed. However, research the name of the dot file in question before deleting it, as it may require technical expertise to understand why it's there. In nearly all cases, it's not worth the effort.