Reduce the size of your package installations automatically!
If you have a significant number of Chocolatey packages you manage, you may notice that you also may have a pretty significant space usage under the Chocolatey lib directory. Package reducer automatically decreases the size of nupkg files to around 5KB and removes installers and zips automatically from your package install directories. This may allow you to save GBs of usage for a large amount of packages being managed!
When you normally create packages that embed or download resources, the impact on a system includes the following:
- A nupkg file size takes up some space - this is like a fancy zip file and may contain binaries
- Files extracted or downloaded to the package directory - this may include zips and installers
- The actual install location if using an installer
- MSI cached by Windows - Windows caches the complete MSI binaries
Typically with this in mind, the size of nupkg could account for an up to 4x impact on a system considering the above. So we typically recommend organizations set a comfortable threshold for package sizes (around 500MB) before splitting out binaries to downloaded resources.
Package Reducer nearly removes that need as it reduces the nupkg file to 5KB by removing all the embedded files. Then it takes it a step further and removes zip and installers from the package directory automatically (configurable by a feature switch, see Setup).
When you turn on Package Reducer, the first two items above no longer take up any significant space. This can reduce space usage in the order of GBs for some installations of Chocolatey.
With Package Reducer:
- nupkg file is reduced to 5KB or less, no matter the size on install
- zips / installers are automatically removed from the package directory if they are found
The following file extensions are removed automatically:
- 7z / zip / rar / gz / tar / sfx
- iso
- msi / msu / msp
- exe files if they are detected to be an installer
So the space usage impact changes to what you'd normally experience outside of Chocolatey:
- the actual install location (package directory, Program Files, etc)
- MSI cache for MSIs
- Chocolatey (
chocolatey
package) v0.10.7+. - Chocolatey Licensed Edition
- Chocolatey Licensed Extension (
chocolatey.extension
package) v1.12.0+.
To turn on Package Reducer, you need to run the following:
choco upgrade chocolatey.extension <options>
choco feature enable -n reduceInstalledPackageSpaceUsage
- If you want to limit to just nupkg files being reduced and not automatically removing zips and installers, run the following:
choco feature enable -n reduceOnlyNupkgSize
Global Config Setting:
reduceInstalledPackageSpaceUsage
- Reduce Installed Package Size (Package Reducer) - Reduce size of the nupkg file to very small and remove extracted archives and installers.
choco install
/ choco upgrade
provide the following option(s):
--reduce, --reduce-package-size, --deflate, --deflate-package-size
Reducer Installed Package Size (Package Reducer) - Reduce size of the
nupkg file to very small and remove extracted archives and installers.
Overrides the default feature 'reduceInstalledPackageSpaceUsage' set to
'False'. Licensed editions only (version 1.12.0+). See
https://chocolatey.org/docs/features-package-reducer
--no-reduce, --no-reduce-package-size, --no-deflate, --no-deflate-package-size
Do Not Reduce Installed Package Size - Leave the nupkg and files alone
in the package. Overrides the default feature
'reduceInstalledPackageSpaceUsage' set to 'False'. Licensed editions
only (version 1.12.0+). See https://chocolatey.org/docs/features-package-reducer
--reduce-nupkg-only, --deflate-nupkg-only
Reduce Only Nupkg File Size - reduce only the size of nupkg file when
using Package Reducer. Overrides the default feature
'reduceOnlyNupkgSize' set to 'False'. Licensed editions only (version -
1.12.0+). See https://chocolatey.org/docs/features-package-reducer
You must have a licensed edition of Chocolatey (Pro, MSP, or Business) and use the community package repository to install/upgrade packages. Pro is a personal, named license that costs about the price of a lunch outing per month and comes with several other features. Business editions are great for organizations that need to manage the total software management lifecycle. MSP editions are for managed service providers and contain the same features as Pro (minus VirusTotal integration).
Once you have set up the feature(s), it will automatically reduce the size of the packaging on install and upgrade.
It just works. When you install or upgrade a package, it will automatically reduce the size of the installation directory if you've set up Package Reducer properly.
- Globally -
choco feature enable -n reduceInstalledPackageSpaceUsage
- Per command - use the option
--reduce-package-size
with install/upgrade commands.
- Globally -
choco feature disable -n reduceInstalledPackageSpaceUsage
- Per command - use the option
--no-reduce-package-size
with install/upgrade commands.
Yes!
- Globally -
choco feature disable -n reduceInstalledPackageSpaceUsage
- Per command - use the option
--reduce-nupkg-only
with install/upgrade commands.
See the next section, the choco optimize
command.
NOTE: CURRENTLY IN PREVIEW - see setup below.
Package Reducer's Package Optimizer is available in all licensed editions starting at Chocolatey Licensed Extension v1.12.0. It is similar to the automatic reduction, except it reduces the size of existing installations.
With Package Optimizer:
- nupkg file is reduced to 5KB or less, no matter the size.
- zips / installers are automatically removed from the package directory if they are found.
- zips / installers are removed from TEMP cache if found.
The following file extensions are removed automatically:
- 7z / zip / rar / gz / tar / sfx
- iso
- msi / msu / msp
- exe files if they are detected to be an installer
choco optimize [<options/switches>]
- Chocolatey (
chocolatey
package) v0.10.7+. - Chocolatey Licensed Edition
- Chocolatey Licensed Extension (
chocolatey.extension
package) v1.12.0+.
Optimize is currently in preview. You need to turn it on by enabling the feature allowPreviewFeatures
:
choco feature enable -n allowPreviewFeatures
choco optimize
choco optimize --reduce-nupkg-only
--reduce-nupkg-only, --deflate-nupkg-only
Reduce Only Nupkg File Size - reduce only the size of nupkg file when
using Package Optimizer. Licensed editions only (version 1.12.0+).
You must have a licensed edition of Chocolatey (Pro, MSP, or Business) and use the community package repository to install/upgrade packages. Pro is a personal, named license that costs about the price of a lunch outing per month and comes with several other features. Business editions are great for organizations that need to manage the total software management lifecycle. MSP editions are for managed service providers and contain the same features as Pro (minus VirusTotal integration).
Once you have set up the allowPreviewFeatures
feature(s), you can just run choco optimize
. Couple it with package reducer features to automatically ensure your Chocolatey installation stays very small.
It goes through all existing packages and removes unnecessary installers and zips. It also deflates nupkg files down to 5KB or less.