What is Chocolatey?
It’s no secret that lately Microsoft has been focusing on the developer market. Their own Azure cloud runs on Linux, they recently introduced a new terminal for windows, and have open-sourced a lot of their programs. Now, Microsoft has recently realized the importance of having a great package manager. Microsoft is currently working on its own package manager for windows which can be installed and tested, but as of now, there is no official support for package management from Microsoft. Luckily, there is a mature and simple to use package manager known as Chocolatey.
Chocolatey is a package manager made for the Windows operating system with dev-ops in mind. Its goal is to save developers and other users time by automating the entire installation process for packages down to a simple installation command. Chocolatey also supports scripts which makes more advanced installations simple and scalable.
Installing Chocolatey is very straight forward. If you are an admin user, all you have to do is open the PowerShell window as an administrator and copying over the installation script.
- Go to https://chocolatey.org/install
- click the blue clipboard to copy the provided script
- search for and open Windows PowerShell or download the new Microsoft Terminal from the Microsoft Store
- Open PowerShell or Terminal by right-clicking and choosing “run and administrator”
- Right-click in the PowerShell or Terminal and the script code will be copied over – click Enter
- Restart PowerShell or Terminal before use
Here are several commands that will be useful to users that want to use chocolatey for basic package management.
- Install package: choco install (package) -y
- Install multiple packages: choco uninstall (package) (package) -y
- Uninstall package: choco uninstall (package) -y
- List installed packages: choco list
- Update all packages: choco upgrade all
Note: -y is used if you do not want to be interrupted by yes/no command prompts. They are not required but will make the installation process smoother.
How to Use – Installing a Single Application:
In this demonstration, I am going to install Mozilla Thunderbird. I will be using the new Microsoft terminal application.
- Open terminal by right clicking and choosing “run as administrator”
- Type the following command: choco install thunderbird -y
Note: if you did not add -y you will be prompted to answer Y/N to some questions. Continue by typing y in the terminal for each question.
As a note, you might be wondering how to run Windows terminal as an administrator each time without actively choosing “run as administrator”. Unfortunately, due to Microsoft believing that this might lead to security vulnerabilities, Microsoft have not included any way to run the terminal as administrator by default.
Uninstall an Application
To demonstrate how to uninstall an application, I will uninstall Mozilla Thunderbird which was just installed using Chocolatey.
To uninstall Mozilla Thunderbird type: choco uninstall thunderbird
Install Multiple Applications at Once
To install multiple applications at once using Chocolatey use the same choco install command but add each package you want to install.
In this example I’m going to install tools like .Net framework, Python and Java Development Kit.
Type: choco install dotnetfx python2 jdk8 -y
Once all the applications were installed I was given a verbose list of all packages that were successfully installed.
Chocolatey is a package manager for Windows that’s easy to implement and allows windows to use basic scripting and package management features like single command line package installation and uninstallation. Being able to simply know the name of a package and install without ever having to visit the software maker’s website has long been a feature on Linux. More and more developers are starting to take advantage of package managers for the convenience and organization they offer. When installing several different tools on new development environments for many developers a package manager becomes a must and Chocolatey allows windows developers to finally take advantage of this useful tool.
When installing applications, simply run the terminal as an administrator and type choco install (package name). You can find an entire list of packages supported by Chocolatey on their website, giving you a centralized location for finding all the tools for your next project. If you decide to uninstall a package, it’s as simple as typing choco uninstall. No need to go look for the application components split across windows and uninstall them individually or have to use the windows uninstaller tool.
Supported Chocolatey package list: https://chocolatey.org/packages?sortOrder=package-download-count&page=1&prerelease=False&moderatorQueue=False&moderationStatus=all-statuses
Install Chocolatey: https://chocolatey.org/install
Chocolatey enterprise license info: https://chocolatey.org/support