Finder & Files

How to Show Hidden Files on Mac (Shortcut, Terminal, Permanent)

Published Nov 2, 2026
Tested on a real Mac. Ran defaults read, ls -a, ls -lO, find -flags and chflags hidden/nohidden on scratch files on macOS Tahoe 26.6.2. defaults write/delete, killall Finder, open, and chflags on the real ~/Library were not run; the Finder shortcut was not scripted. Test machine: MacBook Air (M3, 16 GB), macOS Tahoe 26.6.2, zsh 5.9.
On this page
  1. Method 1: The Finder keyboard shortcut
  2. Method 2: Show hidden files in Terminal
  3. Two kinds of hidden on macOS
  4. Method 3: Show hidden files permanently
  5. Hide or unhide any file with chflags
  6. What about SetFile?
  7. Common questions

To show hidden files on a Mac, open a Finder window and press Cmd+Shift+Period (.). Hidden files appear dimmed. Press the same keys again to hide them.

In Terminal, the equivalent is:

ls -a

The rest of this post covers making it permanent, why some “hidden” files still show up in ls, and how to hide or unhide any file with chflags.

Method 1: The Finder keyboard shortcut

  1. Open Finder and go to the folder you care about. Your home folder or Macintosh HD are good starts.
  2. Press Cmd + Shift + .
  3. Hidden items appear in a lighter, grayed-out style.

The shortcut also works in Open and Save dialogs, which is handy when an app asks you to pick a file inside ~/Library or a dot folder like ~/.ssh.

The shortcut is a quick toggle. If you want a setting you control explicitly, and can script, use Method 3.

Method 2: Show hidden files in Terminal

ls hides names that start with a dot. Add -a to see them:

ls
Library-demo
notes.txt
ls -a
.
..
.secret-dotfile
Library-demo
notes.txt

ls -A is the same but leaves out . and .., which is usually what you want.

Two kinds of hidden on macOS

This is the part most guides skip. macOS hides files in two different ways:

KindHow it is hiddenFinder hides it?ls hides it?
Dot fileName starts with . (like .zshrc)YesYes
Hidden flagA file flag set with chflags hiddenYesNo

To see the flag, use ls -lO (capital O). The flags column shows hidden or -:

chflags hidden notes.txt Library-demo
ls -lO
total 8
drwxr-xr-x@ 2 you  wheel  hidden 64 Nov  2 17:36 Library-demo
-rw-r--r--@ 1 you  wheel  hidden  3 Nov  2 17:36 notes.txt

Gotcha: ls still shows flagged files

After chflags hidden, plain ls printed both items as if nothing changed:

ls
Library-demo
notes.txt

The flag only affects Finder and file dialogs. So if a file is missing in Finder but ls shows it, the hidden flag is the reason. Your own ~/Library is hidden this way, not by a dot:

ls -lOd ~/Library
drwx------@ 94 you  staff  hidden 3008 Sep  5 15:57 ~/Library

The same is true at the top of the disk. ls -lO / on my Mac showed hidden on bin, usr, etc, private, tmp, var, opt, dev, cores and Volumes. That is why Macintosh HD looks so empty in Finder.

To list only flagged items in a folder:

find . -flags +hidden
./copy-p.txt
./notes.txt

Method 3: Show hidden files permanently

Finder reads a setting called AppleShowAllFiles. First check whether it is set:

defaults read com.apple.finder AppleShowAllFiles

On my Mac this printed:

The domain/default pair of (com.apple.finder, AppleShowAllFiles) does not exist

That error is normal. It means the setting was never changed, so Finder uses its default: hidden files stay hidden. The command exits with status 1, so scripts should treat this as “off”, not as a failure.

To turn hidden files on permanently, run:

defaults write com.apple.finder AppleShowAllFiles -bool true
killall Finder

killall Finder restarts Finder so it reads the new value. Open Finder windows close and reopen. I did not run this on the test Mac, because the site’s rule is not to change system settings while testing. It is the standard, widely used command.

To undo it:

defaults write com.apple.finder AppleShowAllFiles -bool false
killall Finder

Or remove the setting entirely so you are back to the macOS default:

defaults delete com.apple.finder AppleShowAllFiles
killall Finder

Hide or unhide any file with chflags

You can hide your own files from Finder without renaming them:

chflags nohidden notes.txt Library-demo
ls -lO
total 8
drwxr-xr-x@ 2 you  wheel  - 64 Nov  2 17:36 Library-demo
-rw-r--r--@ 1 you  wheel  -  3 Nov  2 17:36 notes.txt

The flags column went from hidden back to -. Add -R to apply it to a folder and everything inside.

To make your Library folder always visible in Finder, the command is:

chflags nohidden ~/Library

I tested this exact flag change on a scratch folder, not on my real ~/Library. It is reversible with chflags hidden ~/Library. If you only need Library once, hold Option and open Finder’s Go menu. Library appears in the list.

Gotcha: copying a file can drop the hidden flag

I hid notes.txt, then copied it two ways:

cp notes.txt copy.txt
cp -p notes.txt copy-p.txt
ls -lO
-rw-r--r--@ 1 you  wheel  hidden  3 Nov  2 17:36 copy-p.txt
-rw-r--r--@ 1 you  wheel  -       3 Nov  2 17:36 copy.txt
-rw-r--r--@ 1 you  wheel  hidden  3 Nov  2 17:36 notes.txt

A plain cp made a visible copy. Only cp -p kept the flag. If you hide files with chflags and then back them up with a script, check which copy command it uses.

Dot files are different. A file named .secret-dotfile had no flag at all (- in ls -lO), yet Finder still hides it. Removing the dot from the name is the only way to make it visible without changing Finder’s setting.

What about SetFile?

Older guides use SetFile -a V to hide files. It still exists at /usr/bin/SetFile if the Command Line Tools are installed, but its own man page says it was deprecated with Xcode 6. On my Mac, GetFileInfo -aV reported 0 (not invisible) for a file that chflags hidden had hidden. Stick with chflags; it is built in and matches what Finder does today.

Common questions

What is the keyboard shortcut to show hidden files on Mac?

Cmd + Shift + Period in any Finder window or Open/Save dialog. Press it again to hide them.

Is it safe to show hidden files?

Viewing them is safe. Deleting or editing them is where the risk is. Many hidden files hold app settings and system data. If you are clearing space, read how to find large files on Mac first for what is safe to delete.

Why does .DS_Store keep showing up?

Finder creates .DS_Store in folders to remember view settings. Once hidden files are visible, you will see them everywhere. They are small and harmless. On my Mac, ~/.DS_Store was both a dot file and flagged hidden.

How do I edit a hidden file like .zshrc?

Open it straight from Terminal, for example open -e ~/.zshrc for TextEdit, or nano ~/.zshrc. You do not need Finder to show it first. If you are editing it to fix your PATH, see zsh: command not found: brew.

The defaults command did nothing. Why?

You probably skipped killall Finder. Finder only reads the setting when it starts.