misonoteApp Center

Go build cache (~/Library/Caches/go-build): safe to delete?

Safe to deleteRegenerated automatically; Thermo deletes it outright.

Quit first: go

Where it is

  • ~/Library/Caches/go-build

What it is

The Go toolchain caches compiled packages and test results in GOCACHE, which defaults to ~/Library/Caches/go-build on macOS. It lets repeated builds and test runs skip work when the inputs haven't changed.

Why it gets so big

Each distinct combination of source, Go version and build flags produces new entries. Go trims entries that haven't been used recently, but large dependency graphs, cgo and many build configurations can still keep it big.

Is it safe to delete?

Yes. The only effect is that the next builds and test runs are slower while the cache refills; Go's own clean-cache command does the same thing. The module download cache (GOMODCACHE, usually under ~/go/pkg/mod) is separate and not part of this cleanup.

Tip

Files in the module cache are read-only, so if you want to clear that too, use Go's modcache clean option rather than deleting it in Finder.

See how much space it uses

du -sh "$HOME/Library/Caches/go-build" 2>/dev/null

Clean it with the tool’s own command

go clean -cache

Delete it by hand

Run in Terminal. Deleting cannot be undone, so check the paths first.

rm -rf "$HOME/Library/Caches/go-build"/*