What is Chocolatey and why would I want to use it?
Chocolate: “A typically sweet, usually brown, food preparation of Theobroma cacao seeds, roasted and ground, often flavored, as with vanilla. It is made in the form of a liquid, paste, or in a block, or used as a flavoring ingredient in other foods.” – Entry for Chocolate on Wikipedia
Okay! Not that kind of chocolate!
If you have ever used a Linux distribution you are most likely familiar with a software management tool such as YUM (Yellowdog Updater, Modified) or APT (Advanced Packaging Tool). There are others, but these are the two most common. For those that have never used a Linux distribution, the aforementioned tools allow you to easily install and maintain the software that you have installed on your computer. They allow you to install multiple applications or update them with a simple command from the command line or by utilizing a graphical environment.
Scenario: Your computer was getting sluggish and you decided it was time that you refresh your computer with a clean installation of the operating system. In most cases, especially with Microsoft Windows, you are generally left with a bare shell and will need to spend several hours installing updates and the software you need back onto your computer. In Linux, if you’re using YUM to maintain packages, you can enter yum update -y to update all of the software that is currently installed on the computer with newer versions if newer versions are available. In addition to updating software on the computer you can utilize a package management tool such as YUM to install new packages. You can enter yum install dvdrip kodi vlc firefox to install the four programs specified.
Software deployment tools for Windows have been around for a very long time. However, they are usually reserved for large organizations and cost way too much for the professional consumer (prosumer) market. Fortunately, there is Chocolatey! It is the YUM or APT for Windows that I have been wanting for a very long time! While the commands are somewhat different, it works in much the same way that YUM or APT do on Linux. It makes getting a new computer or a re-imaged computer back up and running much more quickly.
Is it legal?
Yes, Chocolatey is legal. The software that you choose to install is hosted on the vendor web site. When you tell Chocolatey to install Firefox, for example, Chocolatey goes out to its servers and downloads the Firefox package. In the Firefox package are 1.) commands for downloading the Firefox web browser from the Mozilla servers 2.) instructions for performing a silent installation (there will be no prompts to the end user) of Firefox onto your computer. Chocolatey is not hosting or maintaining software on their own servers. You are getting the same application that you would get if you went to the Mozilla Firefox web site and manually downloaded and installed the Firefox web browser.
Is it safe, secure?
Before you install any package via Chocolatey you will want to make sure that it has been classified as a trusted package. Trusted packages have went through a verification process that confirms the application is being downloaded and installed from a reputable source. The verification process also confirms that the installation proceeds as normal.
Not every package on Chocolatey is listed as trusted. Why? Some of the packages are going through the moderation process. Some get rejected because they conflict with another package. You can choose to install packages that are in moderation or even rejected packages. Obviously, you do so at your own risk.
You can setup your own Chocolatey server to install packages from. This will allow you to know exactly where packages are being installed from.
Does it take up too many system resources?
No. Once you install Chocolatey it takes up very little space (apart from the other applications that you install) and it consumes very little system memory. It only runs when you invoke the chocolatey or choco commands.
Where does Chocolatey reside on my computer?
Most of Chocolatey’s files reside in C:\ProgramData\chocolatey, which is hidden by default.
How do I install Chocolatey and begin installing applications?
Installation of Chocolatey
- Open a web browser and navigate to chocolatey.org
- Scroll down to the section titled “Easy Install” and you will see two blocks of command line commands. I usually just use the first one. Copy and past the command, everything but the initial C:\> (this is simply representing a Windows Command Prompt).
- Locate the Windows Command Prompt on your computer and launch it with Administrator privileges.
- Right click in the Command Prompt window and paste the command. Press enter. Chocolatey will now download and install on your computer.
- Close the Windows Command Prompt and re-launch it with Administrator privileges.
Installation of applications from Chocolatey
- Switch back to the web browser from the Windows Command Prompt and navigate back to the chocolatey.org web site.
- Browse through the list of available packages. If you just want to install one package, use the provided command. Example: choco install firefox
- If you want to install multiple packages take note of the package name. I recommend adding each instance that you would like to install to a single line in a simple .txt (Notepad) file. Once you have went through and chosen which applications you want to install, add choco install to the beginning of your list. If you accept the license agreements for any and all applications that you are about to install, then I recommend adding -y to the end of your choco install command. You’ll notice that I do this in every example.
Your command should look something like this:
choco install googlechrome notepadplusplus.install vlc sysinternals -y
Install a specific version
The Chocolatey catalog has all of the previously approved and unapproved versions of each package that is in the catalog.
Example: If you would like to install Audacity version 2.0.5 you would issue the following command in a Command Prompt with admin privileges: choco install audacity -version 2.0.5 -y
What if I install an application and cannot find it?
Occasionally, you will install an application and begin to wonder if it installed and if so where it installed to. It’s usually the portable applications that are available in the catalog that tend to get lost. Portable applications don’t require installation. You simply download the executable and run it, which makes it portable. Since they are portable the installer does not add shortcuts to the Start Menu, Dekstop or Taskbar like a normally installed application would.
One example of this is PuTTY. If you perform a choco install putty -y you can find PuTTY a couple of ways. 1.) Searching for it (Windows 10 is pretty good about indexing the system quickly). 2.) You can usually locate these rogue applications by accessing Chocolatey’s “bin” or “lib” directories C:\ProgramData\chocolatey\bin or C:\ProgramData\chocolatey\lib.
Once you locate the executable you can simply create a shortcut to it like you would any other executable.
Upgrade applications that were installed via Chocolatey
As of this writing the newest version of WinSCP is 5.7.6. In the previous example we installed an older version, 5.7.2. If you would like to upgrade to the newest version you can enter the following command: choco upgrade winscp -y
To upgrade all locally installed packages you can use choco upgrade all -y
List of all applications installed by Chocolatey
With the list command you can view all of the packages that you have installed via Chocolatey: choco list -l
The -l portion of the command tells Chocolatey to only list the local programs. If you entered the command without the -l Chocolatey would list ALL of the available packages that are in the Chocolatey catalog.
Uninstall applications that were installed via Chocolatey
While Chocolatey does a great job of installing applications, it isn’t always great at uninstalling them. Let’s look at Firefox as an example.
You can simply enter the command choco uninstall firefox and it will tell you that Firefox has been successfully uninstalled. However, that is not true. Only the package has been removed from Chocolatey.
To remedy the problem you will want to enable the autoUninstaller feature using the following command: choco feature enable -n=autoUninstaller
When you are uninstalling applications this will bring up the wizard that you would get if you were to remove the program using “Programs and Features” found in the Windows Control Panel.
If the package maintainer did include an uninstall script for the program then Chocolatey will be able to uninstall the program in a more efficient manner. In a lot of cases the package maintainers do not include this. In most instances, you’re probably better off using “Programs and Features” to perform uninstalls. It is unfortunate that not every application cannot be uninstalled as silently as it was installed. The goal of Chocolatey is not to uninstall applications efficiently, but to get them installed in a more efficient manner. I still hope to see better uninstall processes in the future.