LinuxmacOS

Where Does CPAN Store Downloads and Builds?

CPAN clients stage downloads and builds in ~/.cpan with sources in ~/.cpan/sources and build dirs beneath, plus local::lib libraries wherever you pointed them.

Last updated

CPAN clients keep a working area in ~/.cpan for downloads, sources metadata, and build trees. Installed modules land in perl library paths or a local::lib folder you designate. The build area is disposable scratch while installs are the durable result.

That split guides cleanup. Wiping ~/.cpan/build reclaims space without touching anything installed. Local::lib folders deserve real backups since they hold your working modules. System perl upgrades never merge these worlds safely, so separation pays off.

Where CPAN stores this, by platform

Linux
~/.cpan

Download cache, sources metadata, and build trees. Clear build and sources subfolders to fix stuck installs. Installed modules live elsewhere.

macOS
~/.cpan

Same CPAN client layout on macOS Perl setups. Prefer local::lib folders over system paths. Homebrew Perl keeps its own library tree too.

Frequently asked questions

How do I clear the CPAN download cache?

Delete ~/.cpan/build and ~/.cpan/sources to force fresh downloads, keeping installed modules untouched. Corrupt partial downloads hide in these folders and break retries. The cpan client refetches on next install automatically.

Where should Perl modules install?

Set it up once with a local::lib directory outside system perl, then install with cpanm into it. System upgrades then leave your modules alone. Point PERL5LIB at the lib folder in shell rc.

Notice an outdated path? Let us know.