Most of the Windows users doesn't care about how and where desktop applications or other software utilities are installed on their system. The installation of Software in Windows is very straightforward and typical, just download an application that contains an executable and run it (if it is portable) or run the installator (MSI) and follow the wizard. Although that's pretty easy and works even for people that doesn't know about computers or are geeks, it is time consuming because you always have to follow the wizard and select what you need. Most of the time, you only need the default application and that's it, you don't even care where it will be installed if it works because that's the important thing here.
If you are bored of this procedure and want to do it in the developer way, Chocolatey wants to make the installation of Software and developer tools easily without having to click through an unending installation wizards in Windows.
What is Chocolatey?
Chocolatey is the easiest and sane way to manage software on Windows. Chocolatey builds on technologies you know - unattended installation and PowerShell. Chocolatey works with all existing software installation technologies like MSI, NSIS, InnoSetup, etc, but also works with runtime binaries and zip archives. With Chocolatey you can easily manage all aspects of Windows software (installation, configuration, upgrade, and uninstallation) because it is the most reliable when software is included in the package, but can also easily download resources.
If you are a developer that works with NPM, you can imagine Chocolatey as a package manager but for Software in Windows, pretty cool right? For more detailed information about this project, please visit the official website or the open source repository at Github here.
How to install Chocolatey?
All that you need to have is at least:
- Windows 7+ / Windows Server 2003+
- PowerShell v2+
- .NET Framework 4+ (the installation will attempt to install .NET 4.0 if you do not have it installed)
To start with the installation, all that you need to do is to run some commands either in the command prompt or in PowerShell:
The command prompt window or the PowerShell window needs to be running with Administrator Rights, so don't forget to open it as administrator. Before running the commands, check the commands in the official page of installation of Chocolatey here.
A. Install with CMD
Open a new window of the Windows Command Prompt (
cmd.exe) and execute the following instruction:
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Once the installation finishes, restart the command prompt and you are ready to use Chocolatey.
B. Install with PowerShell
With PowerShell, there is an additional step. You must ensure Get-ExecutionPolicy is not Restricted. We suggest using
Bypass to bypass the policy to get things installed or
AllSigned for quite a bit more security. Run Get-ExecutionPolicy. If it returns Restricted, then run
Set-ExecutionPolicy AllSigned or Set-ExecutionPolicy Bypass:
Set-ExecutionPolicy AllSigned; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Once the installation finishes, restart the PowerShell window and you are ready to use Chocolatey. That's it! All you need is
choco.exe (that you get from the installation scripts) and you are good to go, you don't need Visual Studio installed. Remember that is very likely that you will need to close and reopen your shell before you can use choco or open a new CMD or PowerShell window.
To update Chocolatey, you can do it using itself like:
choco upgrade chocolatey
How is it technically made?
Chocolatey has been written in pure C# and it's source code can be found in the official repository at Github here.
To install packages with Chocolatey, you only need to run the following command (replacing package name with the package that you want to install):
choco install <package-name>
There are totally 5074 (till the date of this article) maintained packages that you can find in the official website here. You name it, installing software, tools for developers have been never made so easy as:
REM Install a browser choco install firefox REM or other browser choco install googlechrome REM or install Git ! you name it ! choco install git.install REM a free antivirus ! choco install malwarebytes
Using a GUI for Chocolatey
As a Windows user, we usually love to have a graphical user interface to handle most of the things. Chocolatey as a CLI, is not an exception, that's why Chocolate GUI exists. ChocolateyGUI is a nice GUI on top of the Chocolatey command line tool. It let's you install, upgrade and uninstall packages. It shows you the available packages and it shows the installed packages and all the information about a package. Due to a dependency on the Windows Management Framework, this package will only work correctly on Windows 7 SP1, Windows Server 2008 R2 SP1 and Windows Server 2008 SP2 and above.
To install ChocolateyGUI, run the following command from the command line or from PowerShell:
choco install chocolateygui
Once the installation finishes, you will be able to start it from the Start Menu of Windows and it will look like:
As a developer that works with a lot of technologies and that uses Windows as workspace, Chocolatey makes the things really, really easy and I recommend it for every single developer that works in Windows to prevent headaches with the update of already installed applications.