# Is it safe to delete the Go module cache (~/go/pkg/mod)?

- URL: https://moreroom.app/folders/go-modcache
- Item: Go module cache
- Location: `~/go/pkg/mod`
- Verdict: Safe to remove — Rebuilt or re-downloaded automatically when needed.
- Comes back on its own: yes
- Official command: `go clean -modcache`
- Source: MoreRoom rules catalogue (2026-10-17), by Yando Pte. Ltd.

## What is it?

The module cache holds the source code of every Go module version your projects have downloaded, plus toolchains fetched through `GOTOOLCHAIN`, under `~/go/pkg/mod` by default. Go makes these files read-only to protect them, so moving them to the Trash usually fails with permission errors. It typically grows to a few gigabytes.

## What happens if you delete it?

Modules are downloaded again on the next build, test or `go mod download`, which takes time and bandwidth. Projects that vendor their dependencies are not affected.

## How to remove it properly

Run `go clean -modcache` in Terminal, Go’s own command, which removes the whole cache permanently despite the read-only files; `go env GOMODCACHE` shows its location.
