How to show hidden files on Mac
macOS hides system files, app settings and folders like ~/Library so they don’t get moved or deleted by accident. When you need them, one shortcut brings them back.
Quick answer
Open a Finder window and press ⌘⇧. (Command-Shift-Period). Hidden files and folders appear, slightly dimmed. Press the same shortcut again to hide them.
The shortcut also works in Open and Save dialogs, so you can pick a hidden file from inside any app.
Show hidden files with a keyboard shortcut
- Open Finder and go to the folder you’re interested in. Your home folder (⇧⌘H) is a good place to start.
- Press ⌘⇧..
- Hidden items appear dimmed, so you can tell them apart. Press ⌘⇧. again to hide them.
The setting applies to all Finder windows and stays on until you toggle it off again.
Always show hidden files with Terminal
To set it with a command instead, for example in a setup script for a new Mac, open Terminal (in Applications > Utilities) and run:
defaults write com.apple.finder AppleShowAllFiles -bool true
killall Finder
killall Finder restarts Finder so it picks up the change; your windows reopen on their own. To hide the files again:
defaults write com.apple.finder AppleShowAllFiles -bool false
killall Finder
Open the hidden Library folder
Your user Library folder (~/Library) holds app settings, caches and support files. It’s hidden by default, and there are three ways to get to it:
- Go menu: in Finder, click Go in the menu bar and hold ⌥. Library appears in the list.
- Go to Folder: press ⇧⌘G, type
~/Libraryand press Return. - Always show it: open your home folder, press ⌘J for View Options, and tick Show Library Folder.
See and change hidden files in Terminal
In Terminal, ls -la lists everything in a folder, including hidden items:
ls -la ~
A file can be hidden in two ways on a Mac. The name starts with a dot (.zshrc), or the file has the hidden flag. To see the flags, add O:
ls -lO ~
To hide or unhide a file or folder without renaming it:
chflags hidden ~/Desktop/Private
chflags nohidden ~/Desktop/Private
You can also hide a file by renaming it with a leading dot, but Finder warns you, because names starting with a dot are reserved for system use and the change is easy to forget.
What are all these hidden files?
| File or folder | What it is | Safe to delete? |
|---|---|---|
.DS_Store | Finder’s view settings for that folder: icon positions, sort order, view mode | Yes, Finder recreates it; you lose that folder’s view settings |
._filename | Extra Mac file data, created on drives formatted for Windows (FAT, exFAT) | Usually; the copy on that drive loses its Mac tags and metadata |
.Spotlight-V100, .fseventsd, .Trashes | Search index, change log and Trash on external drives | Leave them; macOS manages them |
.zshrc, .ssh, .gitconfig | Your shell, SSH and developer settings | No, unless you know exactly what’s inside |
~/Library | App settings, caches, mail and support files | No; delete only specific items you’re sure about |
Be careful with what you can now see. Hidden files are hidden for a reason. Deleting the wrong item in ~/Library can reset an app or lose its data. Back up with Time Machine before you clean up, and turn the files back off with ⌘⇧. when you’re done.
Doing it in Quarterglass
If you work with dot files a lot, such as .env files, Git repos and shell config, Quarterglass has a terminal drawer built into the window that follows whichever pane is active. Click into a folder and ls -la runs right there, next to the files, without opening a separate Terminal window and cd-ing around.
FAQ
What is the shortcut to show hidden files on a Mac?
Press Command+Shift+Period (⌘⇧.) in any Finder window or Open/Save dialog. Press it again to hide the files.
How do I make hidden files always visible on a Mac?
Run “defaults write com.apple.finder AppleShowAllFiles -bool true” in Terminal, then “killall Finder”. Use “-bool false” to turn it off again.
How do I find the Library folder on a Mac?
In Finder, open the Go menu and hold Option to reveal Library, or press Shift+Command+G and type ~/Library. To show it permanently, open your home folder, press Command+J, and tick Show Library Folder.
Is it safe to delete .DS_Store files?
Yes. .DS_Store files only store Finder’s view settings for a folder, and Finder recreates them as needed. Deleting one resets that folder’s icon positions and view options.