For those who don’t already know, Chocolatey is a package manager for Windows, similar to the Advanced Packaging Tool (APT) in Debian Linux. Chocolatey is designed for complete applications rather than developer libraries. For that there is a separate tool called NuGet.
This greatly simplifies the process of installing and managing software on Windows machines. The tool also integrates with a number of configuration management tools such as Puppet.
The list of applications available includes many common tools used by developers including:
- VLC Media Player
In a PowerShell v3+ prompt with administrator privileges, Chocolatey can be installed with the following:
PS> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned PS> iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
Chocolatey will then be available from newly launched PowerShell and command prompts.
Install packages with:
> choco install PACKAGE_NAME [PACKAGE_NAME...] # Shorthand command > cinst PACKAGE_NAME [PACKAGE_NAME...]
Uninstall packages with:
> choco uninstall PACKAGE_NAME [PACKAGE_NAME...] # Shorthand command > cuninst PACKAGE_NAME [PACKAGE_NAME...]
Upgrade packages with:
> choco upgrade PACKAGE_NAME|all # Shorthand command > cup PACKAGE_NAME|all
Installing a list of packages
You can install a list of packages using
choco install by specifying
packages.config as the package name. This is an XML file in the following format:
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="putty" /> <package id="thunderbird" version="45.3.0" /> <package id="chocolateytestpackage" version="0.1" source="https://example.com/" /> <package id="alloptions" version="0.1.1" source="https://somewhere/api/v2/" installArguments="" packageParameters="" forceX86="false" allowMultipleVersions="false" ignoreDependencies="false" /> </packages>
There isn’t currently a way to generate this XML automatically from the list of installed packages though. So I created a small Python script to do this by calling
choco list --localonly. The script requires Jinja for the XML template which can be installed with:
pip install jinja
From my initial experience, Chocolatey seems to work pretty well. I was able to convert many of the manually installed applications on my machine to ‘Chocolatey’ installs by re-installing these with
Unfortunately, some of the more advanced features such as the ability to automatically synchronise with “Programs and Features” (prevents choco getting out of sync when using software such as web browser that automatically update) are only available in the paid versions though which start at $8/month. Hopefully some of these features will be brought to the open source version in future.