Using Chocolatey Package Manager on Windows

Updated on April 12, 2021
Using Chocolatey Package Manager on Windows header image

Introduction

Chocolatey is a package manager that makes administering software and dependencies easy on Windows. You can quickly and easily deploy software packages and tools to a new Windows machine in just a few steps. Chocolatey's simple and familiar syntax is easy to learn and can save heaps of time when setting up a new environment.

Installing Chocolatey

Install Chocolatey with either CMD or PowerShell. After installation, you may need to log out and back in to set your new environment.

Option 1: Use CMD

Open an administrative command prompt (right-click Start -> Command Prompt (administrator)) and type the following command:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Option 2: Use PowerShell

Open an administrative PowerShell prompt (right-click Start -> Windows PowerShell (administrator)) and type the following command:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Installing packages

There are hundreds of packages that you can browse on the Chocolatey website https://chocolatey.org/packages or by running:

choco list

Some common server and development packages available through Chocolatey include:

  • hMail Server
  • Java Server Runtime Environment
  • Filezilla Server
  • SQL Management Studio
  • FreeSSHd
  • Telerik Fiddler

To install a package, open an administrative command prompt or PowerShell session and type the following command:

choco install <packagename> -y

Chocolatey will also install any dependencies automatically. You can also include multiple packages in one command to minimize waiting:

choco install visualstudiocode fiddler googlechrome -y

Uninstalling packages/Chocolatey

Packages are removed similarly to how they are installed. Run the following command to uninstall your chosen package:

choco uninstall <packagename>

You can even uninstall Chocolatey itself with this command:

choco uninstall chocolatey

Additional options

For additional command-line options, run Chocolatey with the /? command line switch:

choco /?