1. Home
  2. Guides
  3. Hide files and folders

How-to · Finder, Terminal and Photos · macOS Tahoe 26 and earlier

How to hide files and folders on a Mac — and why hiding isn't protection

Every way to hide something on a Mac, done properly: Terminal, dot names, Spotlight, Photos and the Library folder. Plus how to show and unhide it all, and when you should encrypt instead.

Short answer

To hide a file or folder, open Terminal, type chflags hidden and a space, drag the item into the window and press Return. Use nohidden to bring it back. In Finder, ⌘ ⇧ . shows hidden items. Hiding only stops a casual glance. For anything genuinely private, encrypt it instead.

Want the files locked, not just out of sight? Our guide to every way to password-protect a folder on Mac covers the methods that use real encryption.

On this page
  1. Every hiding method compared
  2. 1. Hide anything with chflags
  3. 2. Start the name with a dot
  4. 3. Keep a folder out of Spotlight
  5. 4. The Photos Hidden album
  6. 5. Stash files in Library
  7. Show hidden files
  8. Unhide everything
  9. Who hiding stops, and who it doesn't
  10. When hiding is fine, and when to encrypt
  11. FAQ

Every hiding method compared

macOS gives you five ways to put things out of sight. None of them locks anything. The last column is the one to read before you hide something that matters.

Method What it hides from Easy to undo Real protection
chflags hiddenTerminal Finder windows. Still found by Spotlight and Terminal. Yes, one command None
Dot at the start of the nameFinder or Terminal Finder and Spotlight. Still listed by Terminal. Yes, rename it None
Spotlight Search PrivacySystem Settings Spotlight results only. The folder stays visible in Finder. Yes, remove it None
Photos Hidden albumPhotos app Your main photo library. The album opens with Touch ID or your login password. Yes, Unhide App lock only
Your Library folder~/Library Anyone browsing your usual folders. Move it back None
Encrypted disk imageDisk Utility, built in Everyone without the password, once ejected. Yes AES-256
DoghouseOur app · same Apple disk images Everyone without the password. Locks itself. Yes AES-256

Scroll sideways on small screens. “Real protection” means someone who finds the item still can't open it.

The difference in one sentence: hiding changes whether you see a file, encryption changes whether anyone can read it. A hidden folder is a normal folder with a “don't show this” note attached. Finder respects the note. Almost nothing else does.

1

Hide anything with chflags

  • Hides from Finder
  • Undo One command
  • Needs Terminal

Every file and folder on a Mac can carry a hidden flag. It's how macOS keeps your Library folder out of sight. You set it with the chflags command, and it doesn't change the item's name or location, so apps and shortcuts that point to it keep working.

  1. Open Terminal from Applications › Utilities, or press ⌘ Space and type “Terminal”.
  2. Type chflags hidden followed by a space. Don't press Return yet.
  3. Drag the file or folder from Finder into the Terminal window. Its full path is typed in for you, spaces and all.
  4. Press Return. The item disappears from Finder. If it's still showing, close and reopen the window.
  5. To unhide it later, run the same command with nohidden instead of hidden.
Terminal
# Hide a folder
chflags hidden ~/Documents/Private

# Show it again
chflags nohidden ~/Documents/Private

# Check: hidden items show "hidden" in the flags column
ls -lO ~/Documents

You don't need sudo for your own files. Hiding a folder hides everything inside it from Finder too. Add -R if you want every item inside flagged as well (the SS64 chflags reference lists all the options).

Spotlight still finds it. As The Eclectic Light Company points out, items hidden with chflags still turn up in Spotlight searches. Search for a file's name and it appears, hidden or not. Pair it with method 3 or use a dot name.

2

Start the name with a dot

  • Hides from Finder and Spotlight
  • Undo Rename it
  • Needs Nothing

Any file or folder whose name begins with a full stop is treated as invisible. This is the old Unix convention behind files like .zshrc, and it has one advantage over chflags: dot-named items are left out of Spotlight results as well.

In Finder

  1. Show hidden items first with ⌘ ⇧ . in a Finder window. Without this, Finder tries to talk you out of dot names.
  2. Select the item, press Return and type a full stop at the start of its name.
  3. Confirm when Finder asks whether you're sure.
  4. Press ⌘ ⇧ . again. The item vanishes.

In Terminal

Renaming with mv skips Finder's warning altogether:

Terminal
# Hide by renaming
mv ~/Documents/Private ~/Documents/.Private

# Unhide by renaming back
mv ~/Documents/.Private ~/Documents/Private

Renaming does change the item's path, so scripts or settings that refer to it by path will need updating.

3

Keep a folder out of Spotlight

  • Hides from Spotlight search
  • Undo Remove it from the list
  • Needs System Settings

Spotlight is how most people stumble on hidden files. You can tell Spotlight to skip a folder or a whole drive. On macOS Tahoe 26 and Sequoia 15, Apple's steps are:

  1. Open System Settings › Spotlight.
  2. Click Search Privacy in the lower right.
  3. Click the add button (+) and choose the folder, or drag it into the list.

On macOS Sonoma 14, the same list is in System Settings › Siri & Spotlight, under a button called Spotlight Privacy.

The exclusion list keeps a folder out of search results, and shows its full path to anyone who opens the list. Illustration, not a screenshot.

The folder stays visible in Finder: this only affects searching. And the list itself is a signpost to exactly what you didn't want found.

4

Hide photos with the Hidden album

  • Hides from Your photo library
  • Lock Touch ID or login password
  • Needs macOS Ventura or later for the lock

Photos has its own hiding place, and it's the best of the built-in options because it's locked. Since macOS Ventura, the Hidden album is locked by default and asks for Touch ID or your login password.

  1. Select the photos and choose Image › Hide Photo, press ⌘ L, or Control-click and choose Hide Photo. They leave your main library.
  2. To see them, choose View › Show Hidden Photo Album, then click Hidden below Utilities in the sidebar, and unlock it with Touch ID or your password.
  3. To take the album out of the sidebar, choose View › Hide Hidden Photo Album.

The lock also covers Recently Deleted. You can switch it off in Photos › Settings › General by unticking Use Touch ID or password, as Macworld explains. If you use iCloud Photos, photos you hide on your Mac are hidden on your other devices too.

Know its limits. Anyone who knows your Mac login password can open the album. The lock guards the album inside Photos; it isn't a separate encrypted folder, and the photos are in your backups and iCloud Photos like any others. It's ideal for stopping private pictures popping up when someone scrolls through your holiday snaps.

5

Stash files in your Library folder

  • Hides from Casual browsing
  • Undo Move it back
  • Needs Nothing

Your home folder contains a Library folder that macOS hides for you. Apps keep their settings and data there and people rarely look, which makes it a tempting place to tuck a folder away.

  • Open it: in Finder, hold Option and choose Go › Library. Or press ⇧ ⌘ G (Go to Folder) and type ~/Library.
  • Make a folder of your own in there with a dull name and put your files inside. Don't mix them into another app's folder.
  • To make Library visible all the time, choose Go › Home, then View › Show View Options, and tick Show Library Folder, as Apple describes.

This is hiding by obscurity, and Library is the best-known hiding place on a Mac. It's also where people clear things out when troubleshooting, so it's a poor home for anything you'd hate to lose.

Show hidden files on a Mac

This is the other side of every method above, and it's the reason hiding isn't protection: showing hidden files takes one keystroke.

The keyboard shortcut

In any Finder window, press ⌘ ⇧ . (Command-Shift-full stop). Hidden files and folders appear, slightly faded. Press it again to hide them. This covers both chflags and dot-named items.

After ⌘ ⇧ ., (1) a dot-named folder and (2) a folder hidden with chflags both reappear. Illustration.

The Terminal setting

Finder also has a long-standing preference, AppleShowAllFiles, that shows hidden files every time. According to macos-defaults.com, the keyboard shortcut toggles this same setting, so on recent macOS the shortcut is all most people need.

Terminal
# Always show hidden files (Finder restarts)
defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder

# Back to normal
defaults delete com.apple.finder AppleShowAllFiles && killall Finder

In Terminal itself

ls -a lists dot-named files. Plain ls ignores the hidden flag completely, so chflags-hidden items show up in every listing, and ls -lO labels them. A few system files, such as .DS_Store, stay out of Finder even with hidden files showing.

How to unhide everything

Forgotten what you hid, or where? Work through the list.

  • chflags. Run chflags nohidden on the item. For a folder and everything in it, use chflags -R nohidden ~/Documents/Private. Don't point -R at your whole home folder: it would also unhide Library and other items macOS hides on purpose.
  • Find what's hidden. find ~/Documents -flags +hidden lists flagged items in Documents, and find ~/Documents -name ".*" -not -name ".DS_Store" lists dot-named ones. The find reference explains the -flags option.
  • Dot names. Show hidden items with ⌘ ⇧ ., then rename the item without the leading full stop, or use mv.
  • The “always show” setting. If Finder shows faded files everywhere, run defaults delete com.apple.finder AppleShowAllFiles && killall Finder.
  • Spotlight. In System Settings › Spotlight › Search Privacy, select the folder and click the remove button (−).
  • Photos. Open the Hidden album, select the photos, Control-click and choose Unhide Photo.
  • Library. Open it with Option and Go › Library, and drag your folder back to where it belongs.

Who hiding stops, and who it doesn't

Hiding works on people who don't go looking. Someone glancing at your Desktop, a child browsing Finder, a colleague watching you share your screen: a hidden folder simply isn't there for them. That's genuinely useful.

It doesn't work on anyone curious enough to try one of these:

  • ⌘⇧. in Finder. The shortcut is on countless help pages and shows everything hidden with chflags or a dot name, in any folder.
  • Spotlight. Type a word from a file's name and chflags-hidden files appear in the results, with their location.
  • Terminal. ls ignores the hidden flag entirely, and ls -a shows dot names.
  • Backups and iCloud. Hiding doesn't take anything out of Time Machine or iCloud Drive. The files are copied there like everything else, unencrypted unless the backup itself is encrypted.
  • Recent files. An app's Open Recent menu can still list a hidden file you opened in it.

And none of it matters once someone has the folder open: a hidden file is a normal, readable file. Only encryption keeps the contents unreadable to someone who finds it.

When hiding is fine, and when you need encryption

Ask one question: what happens if someone finds it? If the answer is “mild embarrassment” or “the surprise is spoiled”, hide it. If the answer involves money, identity, health, work or another person's privacy, encrypt it.

Clutter you don't want to see, or a folder you'd rather not have on show

Hide it with chflags or a dot name

Presents, spoilers, a draft you don't want read over your shoulder

Hiding is fine

Photos that shouldn't pop up when someone scrolls your library

The Photos Hidden album

Tax returns, passport scans, medical records, client files

An encrypted disk image

Private folders you open every day, that should lock when you walk away

Doghouse

A Mac that other people use with your login

Encryption, not hiding

The free, built-in way to encrypt is a disk image from Disk Utility. It's a single file that asks for a password, opens like a drive and locks when you eject it. Our step-by-step disk image guide walks through every setting, and the password-protect a folder comparison sets it against archives, locked PDFs and Notes.

Doghouse makes the same Apple encrypted disk images, called vaults, and handles the chores. Unlock with a password or Touch ID and the vault opens in Finder. Unlocked contents are kept out of Spotlight, “Keep out of iCloud” is on by default, and vaults lock themselves after 15 minutes idle, when the screen locks or when the Mac sleeps. Because vaults are standard disk images, Disk Utility can open them without Doghouse.

Hiding still has a place on top of encryption: an encrypted image with a dull name, hidden too, draws less attention. Just don't let hiding be the only thing between a stranger and your files. More on specific situations: keeping files private on a shared Mac, keeping a folder out of iCloud and locking a folder with Touch ID.

Frequently asked questions

How do I hide a folder on a Mac?

Open Terminal, type chflags hidden followed by a space, drag the folder into the window and press Return. It disappears from Finder. To bring it back, run the same command with nohidden instead of hidden.

How do I show hidden files on a Mac?

In a Finder window, press Command-Shift-Period. Hidden files and folders appear, slightly faded. Press the same keys again to hide them. In Terminal, ls -a lists files whose names start with a dot.

Is hiding a folder enough to keep files private?

Only from a casual glance. Anyone who knows Command-Shift-Period, Spotlight or Terminal can find and open a hidden folder, and it's still in your backups. For anything private, use an encrypted disk image or an app like Doghouse.

Do hidden files show up in Spotlight?

Items hidden with chflags still show up in Spotlight searches. Items whose names start with a dot don't. To keep a whole folder out of Spotlight, add it in System Settings › Spotlight › Search Privacy. None of these stops someone opening the folder in Finder.

Is the Hidden album in Photos password-protected?

Since macOS Ventura, the Hidden album is locked by default and opens with Touch ID or your Mac login password. You can turn this off in Photos › Settings › General. Anyone who knows your login password can still open it.

Can I put a password on a hidden folder?

Not directly. macOS has no password setting for folders, hidden or not. Put the files in an encrypted disk image instead. You can hide the image file as well if you like, but the encryption is what protects it.

About this guide

Written by the Doghouse team at Sprout Media in Dublin. We make Doghouse, a Mac app for encrypted, password-protected folders. Commands and menu paths are checked against Apple's documentation and command references for macOS Tahoe 26, and older names are noted where they differ.

Published · Last updated . Spotted something out of date? Tell us.

Sources

  1. Prevent Spotlight searches in files on Mac — Apple Support
  2. Hide photos with the Hidden album — Apple Support
  3. Hide photos and videos from view on Mac — Apple Support
  4. Library folder — Apple Support
  5. Mac keyboard shortcuts — Apple Support
  6. How to hide files and folders — The Eclectic Light Company
  7. chflags command reference — SS64
  8. find command reference — SS64
  9. Finder: show hidden files — macos-defaults.com
  10. How to show hidden files on a Mac — Macworld
  11. How to lock the Recently Deleted and Hidden albums in Photos — Macworld