Chocolatey sounds yummy and just like the real deal it can be addictive. But what is it?
Chocolatey is a package manager, somewhat like apt-get, but built with Windows in mind. It makes it extremely easy to install Windows applications from a central catalog of installation scripts. With more than 1,300 packages and growing all you have to do is type one line in your console and let Chocolatey do the rest for you.
Let me give you an example of what I mean. If you would like to install the latest Ruby package via Chocolatey just type cinst ruby
in your command line. Yum.
Install Chocolatey#
There are a few ways to install the Chocolatey package manager, but really the easiest method is to open a Command Prompt (Windows Key
+ R
and type cmd
), copy and paste the line below and press Enter
.
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
So what does that scary line do? Excellent question.
Well, basically it utilizes PowerShell, sets your execution policy to unrestricted, dowloads and executes the script from here https://chocolatey.org/install.ps1 and adds Chocolatey to your PATH variable (for this one prompt).
Install a package#
Let’s install a package. I like Redis so let’s do that. Open a command line and execute the command cinst redis
. Chocolatey should now work its magic and install the Redis package for you.
All set. The Chocolatey gods have answered your request.
The Redis package should have also installed a Windows service running Redis Server. Let’s double check that using PowerShell.
PS > get-service *redis*
Status Name DisplayName
------ ---- -----------
Running redis Redis Server
To uninstall Redis simply run cuninst redis
.
For a list of all the different things you can pass to Chocolatey check out their command reference wiki.
Wrapping up#
Just to be clear and a word of warning: Chocolatey is not meant for non-tech savvy people. It is not a full replacement for all installation scenarios, but it is a very powerful tool, and if you’re utilizing it properly, Chocolatey can make your developer or administrator life much easier.