Published on Thursday, 28 June 2018


Chocolatey is a command line package manager. Similar to how linux packagers like aptitude or yum work.You can request a package and it will retrive it along with dependancies from its repository.

By default it targets the public repositroy hosted on (as of writing has 5846 packages). You also have the option of hosting your own repository which can be as simple as creating a file server or running a more dedicated server.

There are also 3rd party services like who can host feeds for you too.

Advantages of Chocolatey over other similar tools

  • It is commandline based which makes it easy to automate.
  • Most configuration tools like Chef, Puppet, PowerShell DCS have resources for it.
  • It is based on Nuget so sharing a server with PowerShell modules and .NET libraries is possible.
  • The free version has all the functionality you need.
  • On windows it has become the standard package format that the DevOps community has got behind.

How to install

Installing chocolatey is trivial all you need to do is the following from an elevated PowerShell Console:

Set-ExecutionPolicy RemoteSigned -Force
iex ((New-Object System.Net.WebClient).DownloadString(''))

Now close powershell and re-open an Elevated PowerShell window.

To verify chocolatey is installed properly you can run:

choco -v

Which will print chocolatey's version to the console.

Finding packages

You can find packages by going to or using the following command:

choco search packagename


choco search firefox

This will list all the packages that match the keyword.

Installing packages

Now that you have found a package you want to install you can do so with the following command:

choco install packagename


choco install firefox

This will now install the package requested however you are probably going to get prompted to accept any license agreements. Which flies in the face of automation. So to accept any license agreement you can add the -yes switch at the end.


chooc install firefox -yes


You can also upgrade software that is installed (including chocolatey) with the upgrade sub command.

choco upgrade packagename


choco upgrade firefox

You can also use all instead of the package name to upgrade all packages installed.

choco upgrade all

Version pinning

If you want to prevent chocolatey from upgrading a specific package you can pin it. To pin a package run the following command:

choco pin add -n=nameofpackage


choco pin add -n=firefox

You can also unpin a package with

choco pin remove -n=nameofpackage


choco pin remove -n=firefox


Uninstalling as you imagine works by using the uninstall command.

choco uninstall packagename


choco uninstall firefox