ClearDisk
Buy for $10Download ClearDiskDownload
A LITTLE MORE CLARITY

How to show hidden files on Mac

To show hidden files on a Mac, open Finder and press Shift-Command-Period (⇧⌘.) to reveal greyed-out dotfiles and folders, then press the same shortcut again to hide them. For ~/Library, hold Option in Finder’s Go menu or press Shift-Command-G.

1. Toggle hidden files in Finder

In any Finder window, press Shift-Command-Period. Hidden files and folders appear greyed out; press the same keys again to hide them. Apple’s published shortcut list does not include this toggle, but it has been part of Finder since macOS Sierra and works in every current version, including in Open and Save dialogs.

What appears are items whose names begin with a dot, such as .DS_Store files in every folder and, in your home folder, developer folders like .npm, .cache, .docker and .gradle. The dot files scattered through documents are tiny; the dot folders in your home folder are the ones that can hold gigabytes.

2. Open a hidden folder directly

When you know the path, Apple’s Finder guide gives the direct route: choose Go → Go to Folder, or press Shift-Command-G, and type the path. A tilde stands for your home folder, so ~/Library opens your user Library and ~/.npm opens npm’s cache. Press Tab to accept a suggested path and Return to open it.

The Library folder is hidden by a different rule than dot folders: it has no dot but Finder hides it anyway. Holding Option while opening the Go menu adds a Library item, and the Library guide covers what is inside and what to leave alone.

3. List hidden items in Terminal

Terminal shows everything by default. ls -la ~ lists your home folder including dot items, and du -sh ~/.[!.]* 2>/dev/null | sort -h sizes each hidden folder and sorts them smallest to largest. Both commands only read. The Terminal guide covers the rest of the measuring commands.

ls -la ~
du -sh ~/.[!.]* 2>/dev/null | sort -h

4. Which hidden folders hold space

On most Macs the hidden folders that matter fall into three groups. Everything in this list is safe to measure; only some of it is safe to remove, and each group has its own guide.

  • Package caches in your home folder: .npm, .cache (pip, pnpm, yarn and many tools), .cargo, .gradle, .m2. Rebuildable; each manager documents a command to clear it.
  • The user Library: Caches, Containers, Application Support, Developer, Mail and Messages. Review-only unless a guide says otherwise.
  • .docker and virtual machine folders: a single disk image can be tens of gigabytes and shrinks only through the app that owns it.
  • .Trash on each volume: the per-disk Trash. Empty it through Finder rather than deleting inside it.

5. Hide them again, and measure before deleting

Press Shift-Command-Period again when you are done; a Finder full of greyed-out files makes ordinary work slower and accidental deletion easier. Nothing you reveal needs to stay revealed to be measured.

Measure before touching anything: Get Info on a folder, the Terminal commands above, or a disk scanner with Full Disk Access that lists hidden folders with allocated sizes and a label. ClearDisk’s free scan shows dot folders and the Library alongside everything else, and moves what you choose to the Trash first so you can put it back.

Common questions

How do I show hidden files on a Mac?

Press Shift-Command-Period in any Finder window, which has worked since macOS Sierra and toggles hidden items, including dot folders like .npm, .cache and .docker in your home folder. Press the same keys again to hide them once you're done.

Are dot folders like .npm and .cache safe to delete?

Package caches such as .npm, .cache, .cargo, .gradle and .m2 are rebuildable, and each manager documents its own command to clear them properly. It's still worth measuring them first, since some, like Docker's virtual machine folders, can be tens of gigabytes.

Why is the Library folder hidden if it's not a dot folder?

Finder hides ~/Library by a different rule than dot folders: it has no dot in its name, but Finder hides it anyway. Holding Option while opening Finder's Go menu adds a Library item so you can open it directly.

What's the Terminal command to list hidden folder sizes on Mac?

Run du -sh ~/.[!.]* 2>/dev/null | sort -h, which sizes every hidden folder in your home folder and sorts them smallest to largest so you can see which ones are worth opening. This command only reads the disk and changes nothing.

References & further reading

These guides combine the linked official guidance with ClearDisk’s documented behavior. Your files and app settings determine the right next step.

Main guide: how to delete files on Mac · Browse all Trash & files guides →

FROM A NUMBER TO AN ANSWER

See what’s using
your space.

Explore your Mac with ClearDisk’s free local scanner.
Review the files. Keep the control.

Download free scannermacOS 15+ · version 2.2.1Cleanup license: $10 once