Most Windows users don’t pay much attention to how desktop programs are installed on their system. For years we’ve been trained to seek out a website, download an EXE or MSI file, and then click, click, click our way through the installation.
It’s an easy method, but it’s also time consuming because of the manual interaction.
A burgeoning project called Chocolatey wants to make it easy to install desktop apps without having to click through an interminable number of installation windows.
What is Chocolatey?
Chocolatey is a command line application installer for Windows based on a developer-centric package manager called NuGet. Unlike manual installations, Chocolatey adds, updates, and uninstalls programs in the background requiring very little user interaction.
Chocolatey has its own package feed that is created and maintained by the project’s community members.
Behind the scenes, most Chocolatey packages simply download a program’s official executable and install it without any further interaction from the user.
You lost me at “command line”
No, wait, hear me out!
Getting new programs the old fashioned way is very easy, but manual installs are also inefficient. Wouldn’t you rather spend your time checking out the latest cat videos on YouTube while your PC goes about installing programs by itself?
That’s the promise of Chocolatey. If the program has any dependencies, such as the .NET framework, Chocolatey will install those too.
Chocolatey can also take care of multiple program installations.
Imagine cracking open a new PC, downloading Chocolatey and then typing a one-line command to install all the programs you’d like to have on your new machine. That's what Chocolatey does.
Getting Chocolatey onto your system is very simple since the commands can be copied and pasted into your command prompt from Chocolatey.org. To start, you need to open an elevated command prompt.
To do this in Windows 8.1, click on the Start button and go to the all apps screen. Under the Windows System heading find Command Prompt, right click-it and select Run as administrator. When the User Account Control window opens, authorize it by clicking Yes.
A command prompt window should open with something like C:\WINDOWS\system32.
Next, visit Chocolatey.org and copy the first box. At this writing, the commands were:
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
Paste it into the prompt, press Enter and your PC will take care of the rest.
Usually doing a copy and paste of commands is not advisable, but in this case it’s just fine.
So you can rest easier, let’s break the instructions down a little bit: These commands are telling your PC to launch PowerShell and don’t load any custom profiles a power user might have. Next, it tells Windows to set the execution policy to unrestricted to allow any PowerShell script to be run and then download and run the Chocolatey install script.
Installing programs Chocolatey style
Once you’ve got Chocolatey up and running, it’s time to start installing programs. Open an administrative command prompt again and type
cinst [program name]
. If you wanted to install VLC you’d type:
Pretty easy, right? The trick is that you need to know the exact name Chocolatey uses for each program. You can’t just type
Google-Chrome and expect Chocolatey to figure it out.
To find the names of programs, you can try playing around on the command line with the trial and error method (which works more often than you’d think). If you don't have that kind of time, search Chocolatey.org’s online package catalog for programs. You can also search for packages right on the command line:
choco search [keyword]
There are two ways to install multiple programs in one sitting with Chocolatey. The first is to type multiple arguments into the command line. If you wanted to install VLC, GIMP, and Firefox you’d type:
cinst vlc gimp Firefox
For much larger batches of programs, however, you’re better off creating an XML document with a .config file extension and formatting it like so:
<?xml version="1.0" encoding="utf-8"?>
<package id="UTorrent" />
<package id="notepadplusplus" />
<package id="IrfanView" />
That basic document structure can include as many programs as you like, and can even include alternative sources other than Chocolatey’s community feed. For a more thorough tutorial on creating a multiple install file, check out developerFusion.
Uninstalling and updating
Updating installed programs via Chocolatey is simple too. Type
cup [program name] into an administrative command. To update DosBox, for example, type:
You can also update all your programs by typing
cup all. If your package is using an alternative source other than the main Chocolatey package feed, you can type:
cup [package name] –source [source URL]
Uninstalling a package is a little different. Going back to our example, you'd type the following to uninstall DosBox:
choco uninstall dosbox
On the next page, we'll cover standardized commands and security concerns.