Go to ...

RSS Feed

June 1, 2020

Toolkit Item: Chocolatey Package Manager

Chocolatey is a package manager that works at the Windows command line (including cmd.exe and PowerShell). That means if you use syntax like
choco install <package-name>
it will install the package named in the command onto the local PC.

What makes this tool so valuable? I can think of several things right off the bat:
1. Chocolatey is an Open Source project, managed through github
2. Most Windows programs you can think of have Chocolatey packages already defined and ready to run (6,887 of them, as I write this story)
3. Chocolatey is well-enough defined and documented that those who want to create new packages for the tool can do so with reasonable dispatch
4. Chocolatey even works as a framework: Chef, Puppet, Boxstarter, PowerShell DSC, Ansible, Saltstack, and other environments offer ways to use Chocolatey to set up and check the state of a computer and the packages it has installed. According to the About page, Microsoft is using Chocolatey’s framework with its PowerShell PackageManagement/OneGet environment (here’s Jeffrey Snover’s post on that topic)

Chocolatey Package Manager.package page

The Packages page lists all 6K+ packages, 30 at a time. I prefer the search engine myself. So will you!
[Click image for full-sized view.]

Working with Chocolatey

Nothing illustrates the value of working with Chocolatey like a good example. Last week I had to return a loaner laptop to Lenovo for repairs, which meant switching over to a replacement unit they kindly sent my way (the fingerprint reader on the Yoga X380 they’d sent me quit working, but worked right out of the box on the replacement). Yes, I could have installed the image from the first PC onto the second, but I decided to customize the new laptop using Chocolatey instead. After updating the version of Windows 10 included on the machine to the May 2019 Update (aka 1903), I used Chocolatey to install the following list of applications:

7-zip                      Google Chrome
8Gadgetpack                Opera
Amazon Kindle reader       Macrium Reflect Free*
Firefox                    Treesize Free
Google Chrome              Voidtools Everything

Turns out that upon visiting Chocolatey.org you can use the built-in search tool there to look for packages by name. I only tried to install one program from my list of usual suspects for which there was no predefined package definition available — namely, Josh Cell’s Uncleaner utility (itself available only through Major Geeks nowadays, the developer’s site having closed down and disappeared from the web a couple of years ago). I was able to get installation going for everything listed above, and only had to run a follow-up installer later for Macrium Reflect. In fact, it turns out that Chocolatey only installs the Macrium Reflect Downloader, which in turn will actually install the complete free version of the program when it’s run later on. The whole exercise took less than 15 minutes, faster than I could’ve finished manually by downloading and installing each item from its web page, and so forth.

You’ll find complete instructions on installing and using Chocolatey, both in Cmd.exe and in PowerShell, if you scroll down on the site’s install page. I did it in PowerShell, which meant unrestricting the local Get-ExecutionPolicy. The necessary instructions to do that are provided for easy cut’n’pasting, as is the full install string for the Chocolatey framework itself. Easy-peasey!

This is a terrific program for power users and Windows admins alike. If you need to set up or customize Windows installations and/or images every now and then (or more often), add Chocolatey to your toolkit. You won’t be sorry you did. This is another one of the very few third-party Windows tools and utilities that Kari also endorses enthusiastically (see his comment to this story, please).

[Note: for whatever reason, my fingers want to type the string “Chocolately” whenever I tell them to type “Chocolatey.” I think I’ve found and killed all those typos in this story. If I’m wrong, post a comment here and I’ll fix any remaining hold-outs. Sigh.]

Author: Ed Tittel

Ed Tittel is a 30-plus-year computer industry veteran. He’s a Princeton and multiple University of Texas graduate who’s worked in IT since 1981 when he started his first programming job. Over the past three decades he’s also worked as a manager, technical evangelist, consultant, trainer, and an expert witness. See his professional bio for all the details.

Leave a Reply

More Stories From Admin Tools