---
title: "Find and delete all node_modules folders on a Mac"
description: "Every JavaScript project keeps its own node_modules, often 200 MB to 1 GB each. Find them all, see their sizes, and remove the ones you don’t need, safely."
url: https://tidymac.space/guides/delete-node-modules-mac/
updated: 2026-10-17
---

[Home](/) [Guides](/guides/) Find and delete all node\_modules folders on a Mac

# How to find and delete old node\_modules folders on a Mac

Every JavaScript project keeps its own node\_modules, often 200 MB to 1 GB each. Find them all, see their sizes, and remove the ones you don’t need, safely.

5 min readUpdated October 16, 2026By the Tidy Mac team

Short answer

node\_modules folders are safe to delete: they hold installed packages, and npm install (or pnpm, yarn, bun install) puts them back from package.json. List them with find ~/Projects -name node\_modules -type d -prune -exec du -sh {} + | sort -h, then remove old ones, or use npx npkill to pick them interactively.

The steps

1.  List every node\_modules folder under your projects folder with its size.
2.  Pick projects you haven’t worked on lately.
3.  Delete their node\_modules with npkill or by moving them to the Trash.
4.  Run npm install (or your package manager’s install) when you return to a project.
5.  Prune the shared package caches too: npm cache clean --force, pnpm store prune.

## Why node\_modules adds up

Every project installs its own copy of its dependencies. A typical web app's node\_modules is 200 MB to 1 GB, and dozens of old projects, tutorials and clones quickly add up to tens of gigabytes. Nothing removes them when you stop working on a project.

## Step 1: List them, with sizes

Replace `~/Projects` with wherever you keep code:

```
find ~/Projects -name node_modules -type d -prune -exec du -sh {} + | sort -h
```

`-prune` stops find from descending into nested node\_modules, so each project is listed once. The biggest are at the bottom. This command only reads.

## Step 2: Delete the ones you don't need

**Interactive (recommended):** npkill lists every node\_modules with its size and age, and deletes the one you select with the space bar.

```
npx npkill -d ~/Projects
```

**By hand:** drag a project's node\_modules folder to the Trash in Finder, so you can still take it back.

`rm -rf` skips the Trash. If you script deletions with find and rm, run the listing command first and read it.

![](/img/brand/tidy-128.png)

### Let Tidy Mac do this for you

See every part of your storage explained, and clear junk to the Trash with Undo. $9.99 once, 2 Macs.

[Download](/download/TidyMac.dmg) [Buy for $9.99 once](/buy/)

## Step 3: Reinstall when you return

In the project folder, run `npm install` (or `pnpm install`, `yarn`, `bun install`). The lockfile brings back the same versions.

## Don't forget the shared caches

Package managers also keep a global cache of everything they ever downloaded:

```
npm cache clean --force
pnpm store prune
yarn cache clean
```

[Where each cache lives](/learn/homebrew-npm-pip-caches/) · [The pnpm store](/folders/pnpm-store/)

## Where Tidy Mac fits

Tidy Mac's Clean screen has a Project folders list: node\_modules, build output (.next, dist, target) and tool caches in projects you haven't touched lately. It only lists a folder when the project's manifest (package.json, Cargo.toml, Podfile) sits next to it, never touches your source, and moves what you clear to the Trash with Undo. [See what's included](/for/developers/) · [Pricing](/#pricing)

## Frequently asked questions

Is it safe to delete node\_modules?

Yes. It only holds installed packages. Running npm install (or your package manager’s install command) in the project rebuilds it from package.json and the lockfile.

How do I see how much space node\_modules uses on my Mac?

Run find ~/Projects -name node\_modules -type d -prune -exec du -sh {} + | sort -h. It lists each folder with its size, biggest last.

Does deleting node\_modules delete my code?

No. Your source files, package.json and lockfile stay. Only the installed dependencies are removed.

Does pnpm save space compared with npm?

Usually. pnpm keeps one copy of each package version in its store and hard-links it into each project, so many projects share the same files. [The pnpm store](/folders/pnpm-store/)

## Keep reading

[Developer package caches on Mac](/learn/homebrew-npm-pip-caches/)[What is pnpm store?](/folders/pnpm-store/)[Tidy Mac for developers](/for/developers/)[Hidden dot-folders in your Mac home folder](/learn/hidden-dot-folders-mac-home/)[How to find duplicate files on a Mac, with Finder, Photos or Terminal](/guides/find-duplicate-files-mac/)[Optimize Mac Storage and iCloud Drive: how it frees space, and when it doesn’t](/guides/optimize-mac-storage-icloud/)

Share:[X](https://x.com/intent/post?text=How%20to%20find%20and%20delete%20old%20node_modules%20folders%20on%20a%20Mac&url=https%3A%2F%2Ftidymac.space%2Fguides%2Fdelete-node-modules-mac%2F)[Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Ftidymac.space%2Fguides%2Fdelete-node-modules-mac%2F&title=How%20to%20find%20and%20delete%20old%20node_modules%20folders%20on%20a%20Mac)[Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Ftidymac.space%2Fguides%2Fdelete-node-modules-mac%2F&t=How%20to%20find%20and%20delete%20old%20node_modules%20folders%20on%20a%20Mac)[LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Ftidymac.space%2Fguides%2Fdelete-node-modules-mac%2F)

#### On this page

[Why node\_modules adds up](#why-node-modules-adds-up)[Step 1: List them, with sizes](#step-1-list-them-with-sizes)[Step 2: Delete the ones you don't need](#step-2-delete-the-ones-you-don-t-need)[Step 3: Reinstall when you return](#step-3-reinstall-when-you-return)[Don't forget the shared caches](#don-t-forget-the-shared-caches)[Where Tidy Mac fits](#where-tidy-mac-fits)[FAQ](#faq)

**Tidy Mac**

See this on your own Mac in under a minute. $9.99 once, 2 Macs.

[Download](/download/TidyMac.dmg)
