---
title: "How to clear the npm cache on a Mac · Gigamop"
description: "Clear the npm cache on a Mac with one command, check how big it is first, and why it's safe for your projects."
url: https://gigamop.com/guides/clear-npm-cache
updated: 2026-10-21
---

# How to clear the npm cache on a Mac

2 min read · Updated 21 Oct 2026

## Short answer

```sh
npm cache clean --force
```

It only deletes downloaded packages. Your projects keep working; npm downloads what it needs on the next install.

## 1. Check how big it is

npm keeps its cache in a hidden folder in your home folder.

```sh
du -sh ~/.npm/_cacache
```

## 2. Clear it

npm asks for `--force` because the cache repairs itself and rarely needs clearing by hand.

```sh
npm cache clean --force
```

## 3. Check it worked

```sh
npm cache verify
```

## Is it safe?

Yes. The cache only holds copies of packages from the registry. Nothing in your projects' node_modules changes.

## Package caches on our test Mac

- npm: 14.0 GB
- Gradle: 6 GB
- uv: 3.8 GB
- CocoaPods: 2.9 GB
- npx: 2.2 GB

Gigamop finds all of these, plus simulators and worktrees, in one scan. [Download Gigamop for Mac](https://gigamop.com/download/latest), free to scan.

## More guides

- [How to delete Docker images on a Mac](https://gigamop.com/guides/delete-docker-images)
- [What’s in System Data on a Mac](https://gigamop.com/guides/mac-system-data)
- [How to remove old git worktrees](https://gigamop.com/guides/remove-git-worktrees)
