A Case for Chocolatey

May 28, 2020 17:02

Package managers are important. Anyone who uses Mac is probably familiar with Homebrew or the 'brew' command. Linux users may be familiar with apt-get. But most people, even Windows users, are unaware that package managers are available for the OS.

If you're unfamiliar with package managers altogether, Wikipedia defines them as:

A package manager or package-management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer's operating system in a consistent manner.

Typically with Windows, to install any software, you have to download an executable, run it, and click next a bunch of times on a bunch of options you don't really care about. And to uninstall, you have to either hunt down an uninstaller hidden in the program directory, or use the windows "Add and Remove Programs" feature which sometimes doesn't even know everything you've installed. And well, "adding" programs uses the Windows store and installs UWP's whenever possible, and who wants that?

That's where Chocolatey comes in. A simple package manager with a command line interface and optional GUI.

Installation is very simple. Pull up Powershell with administrative access, set execution policy to allsigned with Set-ExecutionPolicy AllSigned and run this installation 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'))

With that, Chocolatey (or the choco command) will be ready to use in seconds. From there, you can run commands like choco search googlechrome and you'll get a list of programs with the name googlechrome. Of course, if you don't find exactly what you're looking for, you can always use Chocolatey's online search feature where you can get more information on exactly what the program is.

Installing and uninstalling is as simple as running:

choco install googlechrome choco uninstall googlechrome

Chocolatey will automatically install everything in the background and if you're installing something like JDK or Python, environment variables are automatically set so you can skip that entire step as well.

From there, one of Chocolatey's best features is upgrade all. Running choco upgrade all runs through the list of all the software you've installed with Chocolatey, checks for updates, and runs those updates to make sure you're always using the latest version of all of your software.

There are some advanced features such as pinning a program to skip it's updates and tracking programs that haven't been installed via Chocolatey, but I won't go through those here.

If you want to simplify things as much as possible, one Chocolatey user has even provided two scripts that will create windows tasks to run upgrade all automatically on a schedule.

And the last feature I want to cover is installing via a config file. If you create an XML file ending with .config listing all software you want installed you can run choco install foo.config. It then installs every program in that list automatically. This is great for new and clean installs of Windows.

And the easiest way to generate that file is with Chocolatey GUI. It's a great program in itself. It gives you a GUI interface to see what programs you have installed, as well as search for and install new ones. But my favorite feature is the export button which generates an XML file that can be used with choco install.

I've never used Homebrew and I haven't done much with Linux. But Chocolatey is as full featured as it gets. It's free and open source for everything I've talked about above. There's a Pro version that has some advanced features such as malware scanning and a CDN to avoid failed downloads from external sources.

It's business solution even provides an interface for managing multiple machines across a network. Disappointingly, this is the only version with the choco sync command which searches preinstalled programs on Windows and manages those as well.

Overall, I think every Windows user should be using it as it's the best Windows package manager out there. Mostly due to the fact that everything seems to be available on it. Even for non-technical users I would highly recommend powering through the installation process and getting the GUI set up for managing software on your machine. It makes updating and keeping your computer secure in a way that is so much easier than Windows native tools do.

Back to Home


Created by Ethan Glover