In our third back-to-basics blog post, we're going to take a slight step backwards, and talk about "What is Chocolatey?".

In our first two blog posts, we found out what the Chocolatey Community Repository is, and how to create your own packages, Now that we have this information at hand, we can dive deeper into exactly what Chocolatey is, and what it does for us.

A Little History

Chocolatey CLI was created by Rob Reynolds in 2011 (it had its 13th birthday in March this year) with the simple goal of offering a universal package manager for Windows. Chocolatey CLI is an open-source project that provides developers and admins alike, with a better way to manage Windows software.

We launched Chocolatey for Business (C4B) in 2016 that provides complete software lifecycle management, built on top of our popular open-source product Chocolatey CLI. C4B is backed with dedicated support, services, and roadmap with a focus on three value-added areas:

  • improved security.
  • enhanced productivity features.
  • enabling complete visibility of your software and package environment.

What Is a Package Manager?

This was covered in our second back-to-basics blog post, but it is worth emphasising the main point:

Chocolatey CLI is a package manager for Windows. If you've used Linux, then you're likely familiar with at least one of the various package managers available on that platform such as APT, Yum, DNF, or Pacman (among many others). On macOS you can use Homebrew for your package management needs.

Why Would I Want to Use a Package Manager?

Making use of a package manager makes the installation of software onto your computer much easier! It takes away a lot of the manual work that needs to be performed, to the point that installation of software can be completely automated.

Let's look at an example, consider the installation of a fictitious piece of software called "SoftwareA". Without a package manager, what do you need to do to install this software? You need to:

  • Find out where to download the software from.
  • Download the installation files that are appropriate for the computer that you are using (x86/x64).
  • Understand how that installer works and provide any additional command line arguments that need to be passed in.
  • Invoke the software installer and click through any screens that require input, or license acceptance.
  • Repeat this entire process again during upgrade, or on another machine.

A package manager provides a much easier, and repeatable, way to accomplish all of these steps!

What Is Chocolatey CLI?

Chocolatey CLI is the package manager for Windows. To re-iterate that point, as it is worth repeating, it is the package manager, for Windows. It manages packages. A package can contain the necessary instructions to install a piece of software onto your computer, but those instructions are part of that package. Chocolatey itself is not responsible for those instructions, only the installation of the package, onto your computer:

  • Chocolatey manages packages.
  • Packages manage software.
  • Chocolatey does not manage software.

Using the example that we started above, if we wanted to install "SoftwareA" onto our computer, Chocolatey CLI removes all of the above manual steps, and allows the installation of the software onto your computer with the use of a simple to understand command. Assuming that the software that you want to install exists on the Chocolatey Community Repository (if it doesn't you could look to create a package for it), and that you already have Chocolatey CLI installed, installing software is as easy as:

choco install SoftwareA

How Do I Install Chocolatey CLI?

The process of installing Chocolatey is well documented on our website. The typical installation can be completed using a single line of PowerShell from an administrative shell:

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

If you need more control over the installation of Chocolatey CLI, you can check out the other options.

Why Does Chocolatey CLI Require Administrative Permissions?

By default, Chocolatey CLI requires administrative permissions to run. This is done for a number of reasons, and one of the primary ones is security. We want the installation, and running, of Chocolatey CLI to be secure by default. This means locking down the installation folder of Chocolatey CLI, which needs administrative permissions. In addition to this, most Chocolatey packages use native installers (MSI, InnoSetup, etc.), that write to the Program Files folder, which again requires administrative permissions to complete.

However, it is possible to run Chocolatey CLI without administrative permissions. But, some packages require administrative permissions to install and will not install properly without them.

In addition, C4B provides the ability for non-administrator users to perform installations with administrator permissions using Chocolatey Agent (background service).

If you prefer to use a graphical interface for package management, Chocolatey GUI provides that ability. While this post is about Chocolatey CLI, as one of the core maintainers of Chocolatey GUI over the years, it would be remiss of me not to mention it!

Can Chocolatey CLI Manage Other Software Types?

Yes!

A Chocolatey package doesn't just contain instructions on how to install a piece of software, a package can contain:

  • Software installers.
  • Portable executable files.
  • Zip/Compressed files.
  • Random files, such as fonts.
  • License keys.
  • Registry keys.
  • Scripts that do... anything.

Got Questions?

Now that we have gone over what Chocolatey CLI is, and what it can do for you, you may have some burning questions. I've tried to predict some here, but skip to the bottom of this post for a link to our Community Hub on Discord to ask any unanswered questions.

What is the Difference Between Chocolatey CLI and WinGet?

This is a question that comes up from time to time, and it is one that requires more than just a section at the end of a blog post. Our very own Paul Broadwith recently presented a talk titled "Comparing WinGet and Chocolatey: A Real-World Look at Package Management Tools" at PSConfEU. This talk was recorded, and I would encourage everyone to watch it.

Does Chocolatey CLI Work on Linux/Mac?

First and foremost, Chocolatey CLI is the Windows Package Manager. It is not intended to install/uninstall/upgrade software on any other Operating System, other than Windows.

However...

There are some Chocolatey workloads that make sense to be executed on another Operating System. For example, you might be creating Chocolatey packages on a Continuous Integration platform like GitHub Actions, using Ubuntu, and you want to run the choco pack and choco push commands, without spinning up a Windows Virtual Machine. For these types of scenarios, you can use Chocolatey CLI on these platforms, assuming that they have Mono installed. There is also an official Chocolatey Docker Image available on Docker Hub, which can be used to help with these types of workloads.

I Have More Questions!

Check the General Chocolatey FAQ or reach out for community assistance on our Community Hub Discord Server.

Summary

This is the third in our back-to-basics series. Chocolatey CLI, the Windows Package Manager, is an every day tool for many people, and at the time of writing has been downloaded 330,148,996 times, and responsible for the installation of 2,887,299,830 packages.

I hope that this post has provided some insight into exactly what it is, and what it can do for you.

If you have any more questions, please reach out for community assistance on our Community Hub Discord Server.


comments powered by Disqus