Chocolate bar

In this article, I will describe how to install and use the Chocolatey Package Manager on Windows. But first, what is Chocolatey?

To get the best explanation, it is best to quote the makers of chocolatey. “Chocolatey is a package manager for Windows (like apt-get but for Windows). It was designed to be a decentralized framework for quickly installing applications and tools that you need. It is built on the NuGet infrastructure currently using PowerShell as its focus for delivering packages from the distros to your door, err computer.”

Installing Chocolatey

Before you install chocolatey, make sure you have the minimum requirements:

  • Windows 7+ / Windows Server 2003+
  • PowerShell v2+
  • .NET Framework 4+ (the installation will attempt to install .NET 4.0 if you do not have it installed)

First, open an elevated powershell window by:

  1. Click on your start menu
  2. Type powershell
  3. Shift + Right click on Powershell, select run as administrator

Next, run the following command to install Chocolatey:

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

After the command completes, you should have chocolatey installed. You can run choco -? to confirm that it is properly installed.

Searching for Packages

There are two main ways you can search for packages. You can do it via the web by going to the chocolatey gallery. Or you can search via the cli. To get started, open a powershell window.

From your powershell prompt, enter your search command. All search commands start with “choco search”. For example

choco search firefox

-or-

choco search git

The above commands will return the names of various chocolately packages in the online chocolatey gallery. Once you have found the name of the package you want to install, you can move on to the Installing Packages section of this article.

Installing Packages

Once you have identified the packages you want to install, it is very easy to install packages using chocolatey. The first step is to open an elevated powershell window. Then, if you want to install google chrome, you would run the following command:

choco install googlechrome -y

the -y on the end is to tell it not to prompt you to confirm that you want to install. After you run the command, it will go to the chocolatey gallery, pull down the nuget package, then reach out to the appropriate URL and pull down the installer, then run the installer in silent mode.

When the process is complete, you will have Google Chrome installed.

If you wanted to install Firefox, you would simply run:

choco install firefox -y

If you happen to be using puppet, you would install a package using code similar to this:

package { ‘firefox’ :
provider => ‘chocolatey’,
ensure => ‘latest’,
}