Clear Chocolatey Cache in Free Version – How To

cachechocolateywindows

Installation-file-cleaning is currently only available in the licensed edition of Chocolatey ($96 a year) and the developers seemingly have no plans to offer cache-cleaning support for the free version.

The package installation files can easily take gigabytes of storage space and to my knowledge they only increase in size as the user updates packages and installs new software, with only your hard drive capacity as the upper limit.

I don't know if Chocolatey stores cache in one central location — something is saved to ~\AppData\Local\Temp but the majority is located in the lib* folders in ~\ProgramData\chocolatey. Also the log files in the logs folder total to over 100 MB on my system. Is there any way to fully clear Chocolatey cache without manually deleting directories?

Best Answer

You may use for cleaning the cache the unofficial but approved package of choco-cleaner.

The installed package creates a Windows Scheduled Task to run Choco-Cleaner.ps1 every Sunday at 11:00 PM.

To install, run the following:

choco install choco-cleaner

To upgrade (unofficial) Choco Cleaner (Script + Task), run the following:

choco upgrade choco-cleaner

You may also manually run this task immediately in one of the following ways from the documentation:

  • Command Prompt:

    \ProgramData\chocolatey\lib\choco-cleaner\tools\Choco-Cleaner-manual.bat
    
  • PowerShell:

    Set-ExecutionPolicy -ExecutionPolicy Unrestricted
    \ProgramData\chocolatey\bin\Choco-Cleaner.ps1
    
  • Windows Start Menu: If you have choco-shortcuts-winconfig installed you'll find it with the rest of the Chocolatey Shortcuts.

Related Question