Hide files in Finder with chflags hidden

The hidden file flag hides an item from Finder and open dialogs without requiring a dot-prefix rename, which would break paths in scripts and apps.

macOSFinderhiddenchflagsLow risk
Run `chflags hidden ~/Desktop/notes.txt` to hide the item and `chflags nohidden` on the same path to bring it back.

01Command

Command
$ chflags hidden ~/Desktop/notes.txt
chflags nohidden ~/Desktop/notes.txt

02What it does

Unlike Unix's dot-file convention, the macOS hidden flag works on any file name and is what Finder itself toggles when you set visibility through other tools. Hidden items remain accessible by exact path and via Shift-Command-. in Finder, so the flag is cosmetic rather than security.

03Risk

RiskLow risk
!Warning: This hides items only from Finder views; the file is still readable by any process that knows the path.

04Undo

Undo
$ chflags nohidden ~/Desktop/notes.txt

05Sources

Last verified: 2026-09-17 · Category: Files & Folders

06Related solutions