Hidden files · macOS

On this page 7

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.

MechanismHow it is appliedVisible with lsTypical examples
Leading dot in nameRename the file to start with a periodOnly with ls -a.zshrc, .ssh, .DS_Store
Hidden file flagchflags hidden followed by the pathYes, flag shown by ls -lO~/Library, /usr, /bin
The two hiding mechanisms in macOS

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.

ItemCreated byPurpose
.DS_StoreFinderStores folder view settings and icon positions
._ files (AppleDouble)macOS on non-Apple volumesHold extended attributes and resource data
.Spotlight-V100SpotlightContains the search index of a volume
.fseventsdFile system events serviceLogs changes used by backups and indexing
.TrashesFinderHolds deleted items on external volumes
.zshrc and .zprofileUser or installerConfigure the zsh shell in Terminal
~/LibrarymacOSKeeps preferences, caches and app support data
Frequently encountered hidden items

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:

MethodScopePersistenceBest for
Command-Shift-PeriodAll Finder windows and dialogsUntil toggled againQuick, occasional access
defaults write AppleShowAllFilesFinder globallyPermanent until reversedDevelopers who always need dot files
Show Library Folder optionHome folder onlyPermanentUsers who often edit app preferences
Go to FolderOne specific pathSingle navigationOpening a known hidden path such as ~/Library
ls -la in TerminalOne directory listingSingle commandInspecting names, sizes and permissions
Methods for revealing hidden files

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.

MistakeConsequenceSafer practice
Deleting ~/Library contents to free spaceApps lose settings or stop workingRemove caches for one app at a time
Deleting the .git folderVersion history is lostBack up before cleaning a project folder
Treating hidden as privateSensitive data stays readableUse encryption or permissions
Leaving all files visible permanentlyClutter and accidental editsToggle visibility only when needed
Mistakes, consequences and safer practice

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.