---
title: "Find the Largest Files on Your Mac (Simple Script & Tools)"
description: "Find and delete large files on your Mac with a free Bash script, Finder search, mdfind, and ncdu. Free up storage on macOS Sequoia & Tahoe with safe cleanup tips."
date: 2026-08-09
categories: ["tools"]
tags: ["mac","bash","terminal"]
---

import Button from "@components/widgets/Button.astro";
import Notice from "@components/widgets/Notice.astro";
import ListCheck from "@components/widgets/ListCheck.astro";
import Accordion from "@components/widgets/Accordion.astro";
import Tabs from "@components/widgets/Tabs.astro";
import Tab from "@components/widgets/Tab.astro";

Running out of disk space on your Mac but can't figure out where it all went? You're not alone. Apple's own storage tools in macOS Sequoia and Tahoe give you a high-level overview but often hide the real culprits: orphaned AI models, Time Machine snapshots, and APFS clones that report misleading sizes. Third-party "disk cleaner" apps charge subscriptions for what a few terminal commands can do for free.

This guide covers five ways to find large files on Mac: a zero-setup Finder search, the instant `mdfind` Spotlight CLI, an improved Bash script for full system scans, modern interactive CLI tools, and the hidden space eaters that most guides ignore. Everything here works on macOS Sequoia 15.x and Tahoe (macOS 26).

<Notice type="info" title="Apple Intelligence uses ~7 GB of disk space">
macOS Sequoia 15.3+ stores Apple Intelligence assets locally. You can see the storage usage in System Settings &gt; General &gt; Storage (click the info icon next to macOS). Terminal-based methods like the script below still give you the full picture of everything eating your disk, including files System Settings won't show.
</Notice>

If you're looking for free Mac apps beyond disk cleanup, check [toolhunt.net mac apps section](https://toolhunt.net/mac/).

## Quick method: Finder search (no Terminal needed)

The simplest way to find large files uses Finder's built-in search. No Terminal, no scripts, no installs. This is enough for most casual cleanup.

<ListCheck>
<ul>
<li>Open Finder and press <code>Cmd + F</code></li>
<li>Click "This Mac" to search the entire drive (not just the current folder)</li>
<li>Click the first dropdown → select "File Size"</li>
<li>Set the condition to "is greater than"</li>
<li>Enter a threshold: <code>1 GB</code> (adjust to 500 MB for smaller drives, or 5 GB if you only want the biggest offenders)</li>
<li>Click the "Size" column header to sort results largest-first</li>
</ul>
</ListCheck>

<Notice type="info" title="Threshold tips">On a 256 GB drive, start with 500 MB. On a 1 TB+ drive, start with 1 GB. You'll get a manageable list instead of hundreds of results.</Notice>

Finder search has limits: it won't show hidden directories (`~/Library`, `~/.ollama`), system files, or files inside app bundles. For those, you need Terminal methods.

## Spotlight CLI: `mdfind` for instant results

`mdfind` queries the Spotlight index, making it near-instant compared to walking the filesystem with `find`. It's the fastest way to locate large files if Spotlight indexing is enabled.

<Tabs>
<Tab name="Find files > 1 GB">
```bash
# Find all files > 1 GB using Spotlight index (near-instant)
mdfind "kMDItemFSSize > 1000000000" -onlyin ~/ 2>/dev/null | \
  while IFS= read -r f; do
    stat -f '%z %N' "$f" 2>/dev/null
  done | sort -rn | head -20
```
</Tab>
<Tab name="Find files > 500 MB">
```bash
# Find all files > 500 MB in your home directory
mdfind "kMDItemFSSize > 500000000" -onlyin ~/ 2>/dev/null | \
  while IFS= read -r f; do
    stat -f '%z %N' "$f" 2>/dev/null
  done | sort -rn | head -20
```
</Tab>
</Tabs>

The output shows byte sizes and full paths, sorted largest-first. You can pipe it through `numfmt --to=iec` for human-readable sizes, though `stat` on macOS doesn't have the GNU `numfmt` by default.

<Notice type="warning" title="Check Spotlight status first">If `mdfind` returns empty or incomplete results, Spotlight may be disabled or rebuilding. Check with:<br/><br/><code>mdutil -s /</code><br/><br/>If it says indexing is disabled, re-enable it with:<br/><br/><code>sudo mdutil -E /</code><br/><br/>Rebuilding the index takes 10-30 minutes depending on drive size.</Notice>

**Caveat:** `mdfind` only finds files that Spotlight has indexed. Some system directories and external drives may not be indexed. For a comprehensive scan, use the Bash script below.

## The Bash script: full system scan

This is the core method — an improved macOS-optimized script that scans your filesystem, reports disk usage, and lists the largest files. The original version of this script had issues with modern macOS permissions and scanned external drives. This version fixes both.

### Prerequisites: Full Disk Access

Since macOS Mojave (10.14), even `sudo` can't access certain user directories without Terminal having **Full Disk Access**. Without it, the script silently skips entire directory trees. The `2>/dev/null` hides the "Operation not permitted" errors.

<Notice type="error" title="Required: Full Disk Access">Without this setting, the script silently skips ~/Library, Mail attachments, Messages, Photos databases, and other large files. You'll get incomplete results without knowing it.</Notice>

**Grant Full Disk Access:**

1. Open **System Settings > Privacy & Security > Full Disk Access**
2. Click the **+** button
3. Navigate to `/Applications/Utilities/Terminal.app` (or your terminal of choice, like [Ghostty](/ghostty-terminal/) or [WezTerm](/install-wezterm-mac/))
4. Toggle it **ON**
5. **Quit and reopen** the terminal for changes to take effect

<ListCheck>
<ul>
<li>macOS 12 (Monterey) or later</li>
<li>Terminal.app (or Ghostty/WezTerm) added to Full Disk Access</li>
<li>Homebrew installed (needed later for CLI tools like <code>dust</code> and <code>gdu</code>). Install from <a href="https://brew.sh" target="_blank" rel="noopener">brew.sh</a>.</li>
</ul>
</ListCheck>

### The improved script

Key changes from the original:
- Scans your **home directory** by default (where most user files live), with `--all` flag for power users
- Uses `-x` to stay on one filesystem (won't wander into external drives or network mounts)
- Excludes noisy directories that waste scan time
- Safer output parsing with `IFS=$'\t'`
- Adds a Time Machine snapshot check at the end

```bash
#!/bin/bash

# Find the largest files on your Mac
# Usage: ./find_large_files.sh [number_of_files]
#        ./find_large_files.sh --all [number_of_files]  (scan entire system)

# Parse arguments
scan_path="$HOME"
num_files=20

if [[ "$1" == "--all" ]]; then
    scan_path="/"
    shift
fi

if [[ -n "$1" && "$1" =~ ^[0-9]+$ ]]; then
    num_files=$1
fi

# Print disk space information
echo "==========================================="
echo "DISK SPACE INFORMATION"
echo "==========================================="
df -h "$scan_path" | awk 'NR==2 {
    printf "Total Space: %s\n", $2
    printf "Used Space:  %s\n", $3
    printf "Free Space:  %s\n", $4
    printf "Usage:       %s\n", $5
}'
echo "==========================================="
echo

# Build exclusion list. Skip directories that waste time or produce noise
excludes=(
    -not \( -path "/System/*" -prune \)
    -not \( -path "/Volumes/*" -prune \)
    -not \( -path "/private/var/vm/*" -prune \)
    -not \( -path "/private/var/folders/*" -prune \)
    -not \( -path "*/Library/Caches/*" -prune \)
    -not \( -path "*/Library/Containers/*" -prune \)
    -not \( -path "*/node_modules/*" -prune \)
)

echo "Searching for the $num_files largest files..."
echo "Scanning: $scan_path"
echo "This may take a minute on large drives."
echo

# Create temporary file for results
tmp_file=$(mktemp)

# Run the scan. -x keeps us on one filesystem
# sudo is needed when scanning / or other users' directories
if [[ "$scan_path" == "/" ]]; then
    sudo find "$scan_path" -x "${excludes[@]}" \
        -type f -print0 2>/dev/null | \
        xargs -0 du -h 2>/dev/null | \
        sort -rh | \
        head -n "$num_files" > "$tmp_file"
else
    find "$scan_path" -x "${excludes[@]}" \
        -type f -print0 2>/dev/null | \
        xargs -0 du -h 2>/dev/null | \
        sort -rh | \
        head -n "$num_files" > "$tmp_file"
fi

# Print formatted results
echo "==========================================="
echo "TOP $num_files LARGEST FILES"
echo "==========================================="
echo
printf "%-8s | %s\n" "Size" "File Path"
echo "-------------------------------------------"
while IFS=$'\t' read -r size file; do
    printf "%-8s | %s\n" "$size" "$file"
done < "$tmp_file"
echo "==========================================="

rm "$tmp_file"

# Check for Time Machine local snapshots
echo
echo "==========================================="
echo "TIME MACHINE LOCAL SNAPSHOTS"
echo "==========================================="
snapshots=$(tmutil listlocalsnapshots / 2>/dev/null)
if [[ -n "$snapshots" ]]; then
    count=$(echo "$snapshots" | wc -l | tr -d ' ')
    echo "Found $count local snapshot(s). These are invisible to find/du:"
    echo "$snapshots" | head -5
    if (( count > 5 )); then
        echo "  ... and $((count - 5)) more"
    fi
    echo
    echo "To reclaim this space: sudo tmutil thinlocalsnapshots / 999999999999 4"
else
    echo "No local snapshots found."
fi
echo "==========================================="

echo
echo "Scan complete!"
```

### Run the script step-by-step

1. **Open Terminal.** Find it in Applications > Utilities or press `Cmd + Space` and type "Terminal". If you want a better terminal experience, consider setting up [Fish shell on macOS](/fish-shell-macos-setup/) for better autocomplete and syntax highlighting.

2. **Create the script file:**
   ```bash
   nano ~/find_large_files.sh
   ```
   Paste the script above, then save with `Ctrl + X`, `Y`, `Enter`.

3. **Make it executable:**
   ```bash
   chmod +x ~/find_large_files.sh
   ```

4. **Run it:**

<Tabs>
<Tab name="Home directory scan">
```bash
# Scan your home directory (default, no sudo needed)
./find_large_files.sh

# Show top 30 files instead of 20
./find_large_files.sh 30
```
</Tab>
<Tab name="Full system scan">
```bash
# Scan the entire system (requires sudo for /System, /private, etc.)
./find_large_files.sh --all

# Full scan, top 50 files
./find_large_files.sh --all 50
```
</Tab>
</Tabs>

When running a full system scan, you'll be prompted for your password. The scan takes 1-5 minutes depending on drive size and whether you have external drives connected.

<Notice type="info" title="df vs du: why the numbers don't always match">The disk space header uses <code>df</code> (filesystem-level view) while the file list uses <code>du</code> (sums individual file sizes). On APFS, these numbers can differ significantly due to clones, sparse files, and purgeable space. See the "Hidden Space Eaters" section below. Don't panic if the math doesn't add up.</Notice>

For long scans, consider running it inside a [tmux terminal multiplexer](/tmux-basics/) so you can detach and come back later.

**Sample output (home directory scan):**

```
===========================================
DISK SPACE INFORMATION
===========================================
Total Space: 460Gi
Used Space:  95Gi
Free Space:  341Gi
Usage:       22%
===========================================

Searching for the 20 largest files...
Scanning: /Users/dragos
This may take a minute on large drives.

===========================================
TOP 20 LARGEST FILES
===========================================

Size     | File Path
-------------------------------------------
13G      | /Users/dragos/.diffusionbee/downloaded_assets/FLUX.1-schnell_flux_schnell_q5p_NNC_all.sqlite
13G      | /Users/dragos/.diffusionbee/downloaded_assets/FLUX.1-dev_flux_dev_q5p_NNC_all.sqlite
8.4G     | /Users/dragos/.ollama/models/blobs/sha256-6e41c39f4490a9e8b7a65916425c6ed97f04ed95bab991c4ab6a462ff84d1608
1.9G     | /Users/dragos/.ollama/models/blobs/sha256-dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff
949M     | /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/MacOS/Resolve
...

===========================================
TIME MACHINE LOCAL SNAPSHOTS
===========================================
Found 3 local snapshot(s). These are invisible to find/du:
com.apple.TimeMachine.2025-01-09-183042.local
com.apple.TimeMachine.2025-01-09-193042.local
com.apple.TimeMachine.2025-01-09-203042.local

To reclaim this space: sudo tmutil thinlocalsnapshots / 999999999999 4
===========================================
```

If the output shows mostly `/System` or `/Volumes` paths, the `-x` flag or exclusions aren't working. Check that you're running the updated script, not the old version.

**Verify:** The disk info header should show your actual drive size and usage. The file list should contain user-level paths (home directory, Applications), not system internals.

## Modern CLI tools: `dust`, `gdu` & `ncdu`

If you find yourself running disk cleanup regularly, a one-shot script isn't the best tool. These three CLI utilities give you interactive, browsable views of disk usage, much better for exploring and deleting on the fly.

All three install via [Homebrew](https://brew.sh):

<Accordion label="dust - Rust-based tree view (12k ★)" group="cli-tools" expanded="true">

```bash
brew install dust
```

`dust` shows the largest directories and files as a proportional tree visualization. It's fast (Rust-based) and the output is immediately readable without navigating a TUI.

```bash
dust ~/              # full home directory tree
dust -F ~/           # files only, no directory summaries
dust -n 30 ~/        # show top 30 entries
dust -d 2 ~/         # limit depth to 2 levels (quick overview)
```

GitHub: [bootandy/dust](https://github.com/bootandy/dust), 12k stars, actively maintained.

</Accordion>

<Accordion label="gdu - Go-based interactive TUI (5.9k ★)" group="cli-tools">

```bash
brew install gdu
```

`gdu` is a fast interactive disk analyzer with arrow-key navigation. It uses parallel processing, making it significantly faster than `ncdu` on SSDs. You can navigate into directories and delete files directly.

```bash
gdu ~/               # interactive mode. Arrow keys to navigate, 'd' to delete
gdu -t 20 ~/         # non-interactive: top 20 largest items
```

GitHub: [dundee/gdu](https://github.com/dundee/gdu), 5.9k stars, Go-based.

</Accordion>

<Accordion label="ncdu - the classic" group="cli-tools">

```bash
brew install ncdu
```

`ncdu` (NCurses Disk Usage) has been the go-to TUI disk analyzer for over a decade. It's slower than `gdu` on modern SSDs but it's available everywhere: Linux, BSD, macOS. The interface is familiar to most sysadmins.

```bash
ncdu ~/              # scan and browse interactively
ncdu -x /            # scan root filesystem, don't cross mount points
```

</Accordion>

<Notice type="info" title="Which one to use?">Use <strong>dust</strong> when you want a quick visual overview without leaving the command output. Use <strong>gdu</strong> when you want to interactively explore and delete files. Use <strong>ncdu</strong> if you're on a system where it's already installed (it's everywhere). All three are free and open source.</Notice>

If you spend a lot of time in the terminal, you can [supercharge your Fish shell with plugins](/best-fish-shell-plugins/) for better tab completion on these commands.

## Where is my "missing" disk space?

You ran `df` and it says 200 GB used. You ran `du` on your home directory and it only adds up to 120 GB. Where did the other 80 GB go? On APFS (the default filesystem since High Sierra), the answer is usually one of three things.

### Time Machine local snapshots

Time Machine stores hourly local snapshots directly on your startup disk. These can consume **tens of GB** but are completely invisible to `find`, `du`, and Finder. They don't show up as files because they're filesystem-level snapshots.

```bash
# Check if snapshots are eating your space
tmutil listlocalsnapshots /

# If you see many snapshots and need space now:
sudo tmutil thinlocalsnapshots / 999999999999 4
```

The `thinlocalsnapshots` command tells macOS to purge local snapshots, freeing space immediately. The priority parameter (`4`) means "low priority." It won't interrupt other operations. These snapshots auto-delete when disk pressure occurs, but manual thinning is safe if you need space now.

<Notice type="warning" title="Hidden snapshots can consume 50+ GB">These won't show up in Finder, du, or the script output. Always check with <code>tmutil</code> if you're mysteriously low on space. The snapshots are separate from your Time Machine backup drive — thinning local snapshots doesn't affect your backups.</Notice>

### APFS clones, sparse files & purgeable space

APFS has features that make `du` output misleading:

- **Clones:** `cp -c` (and many apps like pnpm, uv, git worktrees) creates copy-on-write clones. `du` reports the full size of every clone, but deleting one clone frees **zero** blocks if another clone exists. A `node_modules` tree can report 20 GB in `du` but deleting it frees 3 MB.

- **Sparse files:** Docker's `Docker.raw` disk image and VM images (UTM, Parallels) are sparse files. They report as 64 GB but only occupy the actually-written blocks (e.g., 9 GB). If you're running Docker, see how to [clean up Docker images and reclaim disk space](/cleanup-all-docker-things/).

- **Purgeable space:** macOS marks some files as purgeable (caches, local snapshots, iCloud-offloaded files). They count as "used" in `du` but macOS will auto-delete them when space is needed. You can check purgeable space with:
  ```bash
  diskutil info / | grep -i purgeable
  ```

<Notice type="info" title="df vs du: why the numbers don't match">df shows real filesystem-level usage (what the kernel reports). du sums individual file sizes. On APFS, clones, sparse files, and purgeable space cause these numbers to diverge significantly. When in doubt, trust df for "how much space is actually used" and du for "which files are the biggest."</Notice>

If you're generating [locally AI images like Flux models](/ai-images-mac/), those model files can be 10-13 GB each — and DiffusionBee stores them in `~/.diffusionbee/downloaded_assets/`.

## What's safe to delete (and what never to touch)

The script finds large files but doesn't tell you what's safe to remove. Here's a practical guide organized by category.

<Accordion label="AI models (Ollama, DiffusionBee)" group="safe-delete" expanded="true">

**Ollama models** — stored in `~/.ollama/models/`. Each model is 2-13 GB. Use the proper CLI to remove them (raw `rm` leaves orphaned blobs):
```bash
ollama list              # see what's installed
ollama rm <model-name>   # remove a specific model
```
See the full [Ollama setup guide](/ollama-docker-install/) for managing models properly.

**DiffusionBee models** — stored in `~/.diffusionbee/downloaded_assets/`. These are the largest files on many Macs (13 GB each for FLUX models). You can delete the `.sqlite` files directly if you no longer use DiffusionBee.

</Accordion>

<Accordion label="Docker images and containers" group="safe-delete">

Docker's disk usage adds up fast. Check what's consuming space:
```bash
docker system df         # see Docker's disk usage breakdown
docker system prune -a   # remove all unused images, containers, networks (careful!)
docker image prune       # remove dangling images only (safer)
```

Docker's `Docker.raw` disk image (in `~/Library/Containers/com.docker.docker/`) can be 50+ GB as a sparse file. Its reported size vs. actual disk usage will differ. See the full [Docker cleanup guide](/cleanup-all-docker-things/) for a detailed walkthrough.

</Accordion>

<Accordion label="Developer tool caches" group="safe-delete">

These are all safe to delete — they regenerate on next use:

```bash
# Homebrew cache (old downloads)
brew cleanup -s

# npm cache
npm cache clean --force

# pip cache
pip cache purge

# yarn cache
yarn cache clean
```

Project-level directories safe to delete (they rebuild):
- `node_modules/` — run `npm install` to regenerate
- `.venv/` or `venv/` — run `python -m venv .venv` to recreate
- `.next/` — Next.js build cache, regenerates on `npm run build`
- `target/` — Rust build output, regenerates on `cargo build`
- `__pycache__/` — Python bytecode, regenerates automatically

</Accordion>

<Accordion label="Xcode leftovers" group="safe-delete">

If you've ever had Xcode installed, old device support files pile up:
```bash
# Old iOS/tvOS/watchOS device support (can be many GB)
rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/*

# Old Xcode caches
rm -rf ~/Library/Developer/Xcode/DerivedData/*

# Old simulator data
xcrun simctl delete unavailable
```

</Accordion>

<Notice type="error" title="Never delete these">Do NOT remove anything in these locations unless you know exactly what you're doing:<br/><br/>
• <code>/System</code> — macOS system files<br/>
• <code>/usr</code> (except <code>/usr/local</code>) — system binaries<br/>
• <code>/Library/Extensions</code> — kernel extensions<br/>
• <code>/Library/PreferencePanes</code> — system preference panes<br/>
• Any file you can't identify in a system directory<br/><br/>
When in doubt, don't delete it. Move it to Trash first and see if anything breaks before emptying.</Notice>

If you're unsure whether two directories contain the same content before deleting one, you can [compare folder contents in Terminal](/compare-folders-content-differences/) to check.

## Related terminal tools

If you're spending time in Terminal for disk cleanup and system management, these tools make the experience better:

- **[Ghostty](/ghostty-terminal/)** — modern, GPU-accelerated terminal emulator for macOS
- **[WezTerm](/install-wezterm-mac/)** — terminal with built-in tmux-like multiplexing
- **[tmux](/tmux-basics/)** — terminal multiplexer for long-running scans and multiple sessions
- **[Fish shell](/fish-shell-macos-setup/)** — better default shell with autosuggestions and syntax highlighting
- **[cmux](/cmux-terminal/)** — AI-assisted terminal sessions for power users

## Conclusion

You don't need paid apps to find and manage large files on your Mac. Between Finder search for quick checks, `mdfind` for instant results, the Bash script for comprehensive scans, and `dust`/`gdu`/`ncdu` for interactive exploration, you have everything you need.

The real disk hogs are usually AI models (Ollama, DiffusionBee, Stable Diffusion), Docker images, Time Machine local snapshots, and dev project caches. Run the script once a month or whenever you see the "Your disk is almost full" warning. Apple charges $0.99/month for 50 GB of iCloud storage — but cleaning up local files is free.

<Button text="Back to Top" link="#" variant="outline" color="blue" size="sm" />

## FAQ

<Accordion label="Why does df show different free space than du?" group="faq" expanded="true">

`df` reports filesystem-level usage — what the kernel sees. `du` sums individual file sizes. On APFS, these diverge because of:

- **Clones** — copy-on-write duplicates that share blocks until modified
- **Sparse files** — files that report a larger size than their actual allocated blocks
- **Purgeable space** — files macOS marks as deletable under disk pressure

Trust `df` for "how full is my disk" and `du` for "which files are biggest." They answer different questions.

</Accordion>

<Accordion label="Do I need to grant Full Disk Access to Terminal?" group="faq">

Yes, since macOS Mojave (10.14). Without it, even `sudo` cannot access `~/Library`, Mail, Messages, Photos, and other protected directories. The script will silently skip these paths.

Go to **System Settings > Privacy & Security > Full Disk Access**, add your terminal app (Terminal.app, Ghostty, WezTerm, etc.), then quit and reopen the terminal.

</Accordion>

<Accordion label="What's the fastest way to find large files?" group="faq">

Depends on what you need:

- **Just a few big files?** Use Finder search (`Cmd+F`, filter by File Size > 1 GB). Zero setup.
- **Fast terminal search?** `mdfind "kMDItemFSSize > 1000000000"` — queries the Spotlight index, near-instant.
- **Full system scan?** The Bash script in this guide — comprehensive but takes 1-5 minutes.
- **Interactive browsing?** Install `dust` or `gdu` via Homebrew — best for exploring and deleting interactively.

</Accordion>

<Accordion label="Can I delete Time Machine local snapshots?" group="faq">

Yes. Local snapshots are stored on your startup disk and are separate from your Time Machine backup drive. Deleting them doesn't affect your backups.

```bash
# List snapshots
tmutil listlocalsnapshots /

# Thin them (reclaim space)
sudo tmutil thinlocalsnapshots / 999999999999 4
```

macOS also auto-deletes local snapshots when disk pressure occurs, but manual thinning is safe if you need space immediately.

</Accordion>

<Accordion label="Is the script safe to run on macOS Tahoe?" group="faq">

Yes. The script uses standard POSIX tools (`find`, `du`, `df`, `sort`) and the `-x` flag, all of which work on macOS Sequoia 15.x and the upcoming Tahoe (macOS 26). The exclusion paths and Full Disk Access requirement are the same across both versions.

</Accordion>