Is it safe to delete Go module cache?

~/go/pkg/mod · Safe to delete

What it is

Downloaded Go modules shared by all your Go projects.

Can you delete it?

Yes, it is rebuilt automatically. Go downloads modules again on the next build. The files are read-only, so use the go command, not Finder.

How to clean it safely

  1. See the size: du -sh ~/go/pkg/mod
  2. Run: go clean -modcache

How big is it on your Mac?

This read-only command prints its size and changes nothing:

 Terminal
du -sh ~/"go/pkg/mod" 2>/dev/null

Step-by-step guide: Developer caches on a Mac →

Questions

Is it safe to delete ~/go/pkg/mod?

Yes, it is rebuilt automatically. Go downloads modules again on the next build. The files are read-only, so use the go command, not Finder.

Let the raccoon do it, safely

Junk Raccoon finds this clutter for you, shows every file first, and keeps a one-click way back. Free to download, no account, no ads.

Download for Mac