How to hide a folder on a Mac, and why hidden is not private
· 6 min read
To hide a folder on a Mac, open Terminal and run chflags hidden followed by the folder’s path. Finder stops showing it, and chflags nohidden brings it back. Renaming the folder so its name starts with a period hides it too. Either way, pressing Command-Shift-Period in any Finder window shows every hidden item again, so hiding keeps a folder out of sight, not out of reach.
That is fine for tidying away clutter. For anything private, it is worth knowing exactly where a hidden folder still turns up, and what to use instead.
How to hide a folder on a Mac with Terminal
Finder has no Hide command, but one Terminal command sets the hidden flag that Finder respects.
- Open Terminal from Applications, Utilities.
- Type
chflags hiddenfollowed by a space. Do not press Return yet. - Drag the folder from Finder into the Terminal window. Its full path appears after the command, with any spaces in the name handled for you.
- Press Return.
The folder disappears from Finder. If a window still shows it, close the window and open it again.
To bring it back, you need its path, because you can no longer drag it:
chflags nohidden ~/Documents/Receipts
You can also use a hidden folder without unhiding it. In Finder, choose Go, Go to Folder (Command-Shift-G), type the path, and it opens like any other folder. The same shortcut works in Open and Save dialogs. To check whether a folder carries the flag, ls -lO in its parent folder shows hidden in the flags column.
Hiding it with a period at the start of the name
Names that begin with a period are hidden by a Unix convention that macOS inherited. There is no flag involved; the name alone does it.
In Finder, rename the folder and put a period in front. Finder warns that names beginning with a dot are reserved for the system and that the item will be hidden, then offers a button to use the dot anyway. Confirm, and the folder vanishes. In Terminal it is a plain rename:
mv ~/Documents/Receipts ~/Documents/.Receipts
To undo it, press Command-Shift-Period in that folder so the dimmed item shows, rename it without the period, and press Command-Shift-Period again.
The two methods behave differently in one way that matters, covered below: Spotlight treats them differently.
How anyone can see it again
Hiding is a display setting. Several ordinary things undo it without any password.
Command-Shift-Period. In any Finder window, and in the Open and Save dialogs of every app, this shortcut shows all hidden items, dimmed. It is widely known, and showing hidden files in Finder explains how some people leave it switched on permanently. If they do, your hidden folder is simply there.
Terminal. The hidden flag only means something to Finder and other graphical apps. Plain ls in Terminal lists a flagged folder with no options at all, and ls -a adds the period-named ones.
Any app with access to your files. Backup tools, cloud sync clients, disk space analyzers and archive utilities work with files, not with Finder’s view of them. They see hidden folders like any other.
Time Machine. Hidden folders are backed up like everything else, so a copy sits on the backup disk, readable by anyone with access to that disk unless the backup is encrypted.
What Spotlight still finds
This is where the two methods split.
In our testing on macOS Sequoia, a folder hidden with chflags stayed in Spotlight’s index, along with everything inside it. Searching for the name of a file inside the folder found it, path and all. Finder’s Recents view is built on the same index, so a file you recently opened from a flagged folder can be listed there too.
Folders whose names start with a period behaved differently in the same test: Spotlight left them and their contents out of its index. That makes a period-named folder better hidden from search, but it changes nothing else in the list above.
Two more places remember these files regardless of which method you use. Apps’ File, Open Recent menus remember documents you opened, including ones from hidden folders. And Quick Look thumbnails of those files may already have been generated when you browsed them.
If your real problem is search results, you can tell Spotlight to skip a folder that stays visible. Keeping private files out of Spotlight walks through the Search Privacy list, which sits in System Settings, Spotlight on macOS Sequoia and under Siri & Spotlight on earlier versions.
When to lock a folder instead of hiding it
Hiding is the right tool when the goal is a tidier Finder, or keeping something out of view of a casual glance at your screen. It does nothing against a person sitting at your Mac while you are logged in, which is the situation most people are actually worried about: a partner, a child, a colleague, or anyone who borrows the machine for a minute.
For that, the folder’s contents need to be encrypted, so that opening them takes a password. The built-in option is an encrypted disk image made with Disk Utility (File, New Image, Image from Folder). How to password protect a folder on a Mac compares it with the alternatives, including the trap that the unencrypted original stays behind until you delete it.
If you would rather keep the folder where it is, Hushbox locks it in place from the Finder right-click menu. What is inside becomes an AES-256 encrypted disk image, it stays out of Spotlight, Recents and Quick Look while locked, and it opens again with Touch ID or a password. It is the reverse of hiding in one respect worth stating plainly: the locked item’s name still shows in Finder. Hushbox hides contents, not names, so give the folder a dull one.
Locking covers only the folders you choose. Everything else on the disk, from mail to browser history, depends on FileVault if the Mac is lost or stolen, and it is worth having on regardless.
Questions
Can I hide a folder on a Mac with a password? Not with hiding alone. Finder has no password setting for folders. Encrypt the folder instead, as an encrypted disk image or a locked item. An encrypted disk image is an ordinary file, so you can hide that too if you want it out of sight as well.
How do I find a hidden folder I have forgotten about?
Press Command-Shift-Period in the places you might have put it. To list every flagged folder inside Documents at once, run find ~/Documents -type d -flags +hidden in Terminal; it may ask for permission to access the folder first.
Does hiding a folder hide it from other users on the Mac? Hiding changes nothing for other accounts; permissions decide what they can open. Other standard users cannot open your Documents, Desktop or Downloads folders at all, hidden or not, but folders at the top level of your home folder are readable to them by default. An administrator can reach anything.
Is a hidden folder still backed up? Yes. Time Machine copies hidden folders like any other folder, and other backup tools generally do the same.