Hidden files in macOS are files and folders that exist normally on disk but are not displayed by Finder or by standard Open and Save dialogs. In the Finder & files part of the system they keep configuration data, caches and system metadata out of sight, so that everyday users see only their own documents.
A file becomes hidden in one of two ways: its name begins with a dot, following the Unix convention, or it carries the hidden file flag in the file system. Hidden does not mean protected or encrypted; any user or app with permission can still read, change or delete such files.
How macOS decides that a file is hidden
macOS inherits the dot-file convention from Unix: any name that starts with a period, such as .zshrc or .git, is treated as invisible by Finder and by the ls command without options. The convention is purely a naming rule, so renaming a file to remove the dot makes it visible again.
The second mechanism is the UF_HIDDEN flag, a file system attribute supported by APFS and HFS+. It hides an item whose name looks completely ordinary; the user Library folder in the home directory has been hidden this way since Mac OS X Lion. The flag is set with chflags hidden and removed with chflags nohidden.
| Mechanism | How it is applied | Visible with ls | Typical examples |
|---|---|---|---|
| Leading dot in name | Rename the file to start with a period | Only with ls -a | .zshrc, .ssh, .DS_Store |
| Hidden file flag | chflags hidden followed by the path | Yes, flag shown by ls -lO | ~/Library, /usr, /bin |
Finder also hides several top-level system directories, such as /usr, /bin, /private and /var, which are visible to the shell but omitted from the graphical view to reduce accidental changes.
Common hidden files and what they contain
Most hidden items are created automatically by macOS, by development tools or by applications. The table lists those that users encounter most often, especially when they copy files to USB drives or share folders with Windows computers.
| Item | Created by | Purpose |
|---|---|---|
| .DS_Store | Finder | Stores folder view settings and icon positions |
| ._ files (AppleDouble) | macOS on non-Apple volumes | Hold extended attributes and resource data |
| .Spotlight-V100 | Spotlight | Contains the search index of a volume |
| .fseventsd | File system events service | Logs changes used by backups and indexing |
| .Trashes | Finder | Holds deleted items on external volumes |
| .zshrc and .zprofile | User or installer | Configure the zsh shell in Terminal |
| ~/Library | macOS | Keeps preferences, caches and app support data |
These files explain why a USB stick prepared on a Mac may show unexpected dot files on a Windows PC or a television. They are harmless, but deleting .DS_Store only resets view settings, while deleting AppleDouble files can strip metadata such as Finder tags.
Ways to show hidden files on a Mac
The quickest method is the keyboard shortcut Command-Shift-Period in any Finder window, which toggles hidden items on and off; they appear as dimmed, semi-transparent icons. The same shortcut works inside Open and Save dialogs, which is useful when an app must open a configuration file.
Each method suits a different need, from a one-time glance to a permanent change for developers:
| Method | Scope | Persistence | Best for |
|---|---|---|---|
| Command-Shift-Period | All Finder windows and dialogs | Until toggled again | Quick, occasional access |
| defaults write AppleShowAllFiles | Finder globally | Permanent until reversed | Developers who always need dot files |
| Show Library Folder option | Home folder only | Permanent | Users who often edit app preferences |
| Go to Folder | One specific path | Single navigation | Opening a known hidden path such as ~/Library |
| ls -la in Terminal | One directory listing | Single command | Inspecting names, sizes and permissions |
The Terminal method for a permanent change is defaults write com.apple.finder AppleShowAllFiles -bool true followed by killall Finder. Setting the value back to false restores the default view. The Show Library Folder checkbox appears in View Options when the home folder is open.
Hiding files deliberately
Users can hide their own items with chflags hidden in Terminal or by renaming them with a leading dot, although Finder refuses dot names by default and warns that they are reserved for the system. Hiding is useful for decluttering a shared folder or keeping helper files out of view.
It must never be used as a security measure. Anyone who presses Command-Shift-Period, uses Spotlight in some cases or lists a directory in Terminal sees the item immediately. Confidential material requires FileVault, encrypted disk images or proper file permissions instead.
Risks and common mistakes with hidden files
Hidden files are hidden for a reason: many of them are required by apps or by macOS itself. Leaving hidden files permanently visible makes it easier to drag a preference file to the Trash or to break a development project by deleting its .git folder.
| Mistake | Consequence | Safer practice |
|---|---|---|
| Deleting ~/Library contents to free space | Apps lose settings or stop working | Remove caches for one app at a time |
| Deleting the .git folder | Version history is lost | Back up before cleaning a project folder |
| Treating hidden as private | Sensitive data stays readable | Use encryption or permissions |
| Leaving all files visible permanently | Clutter and accidental edits | Toggle visibility only when needed |
It is also worth knowing that hiding is separate from System Integrity Protection. SIP protects key system locations even from administrators, while a hidden flag only changes what Finder displays.
In simple terms
A Mac keeps many small behind-the-scenes files that its apps need but people rarely touch, much like the wiring hidden inside the walls of a house. To keep folders tidy, Finder simply does not show them.
They are still there, and anyone can reveal them by pressing Command, Shift and the period key together. The important lesson is that hiding is about tidiness, not secrecy, and that deleting hidden files without knowing their purpose can cause apps to misbehave.
A practical example
A web developer sets up a new MacBook and needs to edit the .zshrc file in her home folder to add a path for a programming tool. The file does not appear in Finder, so she opens her home folder and presses Command-Shift-Period; the dimmed .zshrc file appears, and she opens it in a text editor.
Later, a client complains that a ZIP archive she sent contains a strange __MACOSX folder and several ._ files. She explains that these hold Mac metadata and creates future archives with a command-line tool that excludes AppleDouble files.
Finally, she enables the Show Library Folder option so she can reach application preferences quickly, but keeps all other hidden files concealed. The result is a clean workspace in which she reaches configuration files in seconds without risking accidental deletions.