Chocolatey

Chocolatey, the sweetest package manager!

If you are yum, or apt-get guy, you would say probably that such a thing doesn’t exist on Windows platform. Well, there are some good and sweet news – Chocolatey, that’s the name.

As per the official statement on chocolatey web site:

“Chocolatey packages are not just fancy zip files with PowerShell, they understand versioning and dependencies, allowing you to encapsulate everything related to managing installation and configuration for a piece of software.”

which fits into the promotion of Chocolatey as a framework, where packages should address separate software installation concerns from automation tools / configuration managers and use the best tool for software management.

So what happen when we wanna try that? I’m going to answer that on my Windows 10 Pro Machine, in particular, Version 1803 (Build 17134.765)

Note that I’m always using the opportunity to highlight the importance of using the legal software!

According to the requirements section, here is what’s needed:

Requirements

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

let’s use PowerShell ISE environment, as it’s super useful. The official ways are either command or PowerShell prompt, also there is a way to install with both elevated and non-elevated security, but let’s follow this approach. Here is the confirmation of elevated environment and PowerShell version:

I always switch to my home folder (cd ~) before I proceed, so the next would be to check the execution policy. If you type:

Get-ExecutionPolicy -List

it will return the corresponding policy for each scope. Without going into details, it is useful to observe the beginning of the installation process, as that’s about bypassing the execution policy, limiting to process scope, so let’s execute the following command:

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

It will pull the the zip file (the latest package v0.10.13), and start the installation process. Please beware that PowerShell is needed to run Chocolatey, not just for install it. Observe the target directory:

C:\ProgramData\chocolatey

Also, it will ad the entry:

 C:\ProgramData\chocolatey\bin

under the PATH environment variable

Good job! So that’s it, simple as that, no any additional efforts needed, choco can be called from any location, let’s open simple the command prompt and test it:

So how we proceed now, in the same way like we do on Linux boxes, using yum or apt-get install… Yes, pretty much the same. Let’s check which packages are available, sorted by popularity:

and let’s practice the installation process choosing the popular Notepad++ editor. Normally, we would go (first google-it where it is) to visit the official website and find the download location, read the install manual, grab the package and go for it. Would the linux-like alternative:

choco install notepadplusplus

work? Hell yes! Here we go:

Note, in the middle, “oops, I made a mistake..” red line, as the switch -y has to be applied initiating the process, as usual.
If we check installed Apps, we can see that Notepadd++ has been installed successfully:

That’s it, we can just type “notepad++” in the search box and lunch the App.

The version which we have been installed is 7.7, as that’s approved package, from the list command:

and this is exactly what we can confirm opening the App:

Now, let’s test the uninstall process, but this time appending the -y switch. It would be worth to check the log file as well.

Final words: it would be worth to check the chocolatey command reference there are not so many of them, including the switches, and there is also a valuable Sripting/Integration Section.
For any advanced Windows User, simple choco is a must, as morning coffee.