Show hidden files in Finder, and hide them again
· 6 min read
In any Finder window, press Command-Shift-Period. Hidden files appear, dimmed so you can tell them apart from everything else; press the same keys again and they go away. If you want them visible all the time rather than for the next minute, one defaults write line makes it stick, and deleting that preference puts Finder back to normal.
The shortcut, and what it is actually showing you
Command-Shift-Period (the full stop key) works in the front Finder window, on the Desktop, and inside Open and Save dialogs, which is the place people most often need it. It is a toggle: press it again and the extra items disappear.
Two different kinds of file are hidden on a Mac, and the shortcut reveals both.
The first kind is anything whose name starts with a period: .DS_Store, .zshrc, .gitignore, .env, .localized. This is a Unix convention that macOS inherited. Nothing marks these files as special beyond the leading period in the name, which is why renaming a file to start with one hides it immediately.
The second kind is files and folders carrying a hidden flag in the filesystem. The root of your startup disk is full of them: usr, bin, sbin, etc, var, private, opt. They are ordinary directories that Apple flagged so that Finder would leave them out of the picture. Open Macintosh HD with hidden files showing and the disk suddenly looks like the Unix system it has always been.
You will also see .DS_Store in nearly every folder you have ever opened. That file stores the view settings for its folder: icon or list view, sort order, window size, where you dragged the icons.
Make it permanent
If you work with dotfiles daily, toggling gets old. Two Terminal lines cover both directions.
- Open Terminal (Applications, Utilities, or type Terminal into Spotlight).
- Paste this and press Return:
defaults write com.apple.finder AppleShowAllFiles -bool true; killall Finder
- Finder restarts. Desktop icons blink out and come back within a second or two, and any Finder windows you had open close. Nothing else is affected: your apps and documents keep running.
To go back:
defaults write com.apple.finder AppleShowAllFiles -bool false; killall Finder
Or remove the preference entirely, which returns the setting to whatever a fresh Mac would do:
defaults delete com.apple.finder AppleShowAllFiles; killall Finder
If Terminal replies that the domain or default pair does not exist, the key was never set and there is nothing to remove.
One thing worth knowing: the keyboard shortcut and the preference are the same switch. Set the preference to true and the shortcut still toggles it off temporarily. That is usually what you want.
The Library folder is a separate case
The one folder most people are hunting for is ~/Library, and it does not behave like the rest. It is flagged hidden, so the shortcut reveals it, but there are three quieter ways in that do not involve showing everything else.
- Open the Go menu in Finder and hold Option. Library appears in the list while the key is down.
- Press Command-Shift-G anywhere in Finder and type
~/Library, then Return. - Open your home folder, press Command-J for View Options, and check Show Library Folder. That one sticks.
Prefer the third if you go there often. Application Support, Containers, Preferences, LaunchAgents and Fonts all live inside, and it is worth a permanent shortcut in the Finder sidebar (drag the folder there) rather than a system-wide setting.
Note that /Library at the root of the disk and ~/Library in your home folder are different places with overlapping contents. The one in your home folder holds your settings; the one at the root holds settings shared by everyone with an account on the Mac.
Terminal shows them without changing anything
If you only need to look, Terminal never hides anything in the first place:
ls -a
ls -a lists everything in the current folder including dotfiles. ls -la adds permissions, owner, size and date. ls -la ~ does your home folder from wherever you are. Nothing is toggled, nothing restarts, and Finder stays as it was.
This is often the better answer when the task is “check whether a config file exists” rather than “work in this folder all afternoon”.
What not to touch while they are visible
Showing hidden files is safe. Deleting them is where people get into trouble, and the risk is real precisely because they are visible now and look like clutter.
.DS_Storeregenerates on its own, so removing one costs you only that folder’s view settings. If they bother you on shared drives, that is a separate setting rather than a cleanup job.- Dotfiles in your home folder such as
.zshrc,.gitconfigand.sshare your configuration. Losing.sshmeans regenerating keys and re-adding them everywhere. - Folders at the root of the disk (
usr,bin,privateand the rest) belong to macOS. System Integrity Protection stops the worst outcomes, but there is nothing in there you need to reorganize. - Select All in a folder with hidden files showing now includes them. Watch what you are dragging.
Hide them again when the job is done, which is the real reason the shortcut is a toggle rather than a setting buried in Finder preferences.
Doing it with a switch instead
Everything above is a real macOS preference that the system honors and Finder does not expose. If you would rather not keep the command in a note somewhere, Mainspring (https://trymainspring.com/) lists show hidden files as one of its power-ups, alongside related Finder changes like folders on top and showing every file extension. It records the current value before changing anything, so one click puts it back. It is $29 once for up to three Macs and has a one-day trial with everything included and no account.
For this single setting, the keyboard shortcut is genuinely enough and no app is needed. The argument for one starts when you want half a dozen Finder and Dock changes applied on a new machine and reverted together later. Keeping folders at the top when Finder sorts by name and making the Dock appear instantly cover two more in the same family.
Questions
Why do my hidden files look faded rather than normal? Finder dims them deliberately so that a folder does not suddenly look twice as full. It is a display choice only; the files behave exactly like any other file when you open, copy or move them.
The shortcut does nothing in my Finder window. Click once on the window or the desktop background first so Finder has keyboard focus. If you are inside a third-party file browser rather than Finder, the shortcut belongs to that app and may do something else entirely.
Does showing hidden files make Spotlight find them?
No. Spotlight leaves dotfiles and system directories out of its index regardless of what Finder displays. Use Finder’s own search inside a folder, or find and ls -a in Terminal, when you need to locate one by name.
Will a macOS update turn this back off? The preference lives in your home folder and normally survives updates. If Finder ever reverts, run the command again; it takes a few seconds. The Show Library Folder checkbox is the one people most often find reset after a major upgrade.