Installing & Using Chocolatey Package Manager for Windows
Dave Schinkel 5/20/2015 03:10:00 PM Tools
I'm very used to using tools like npm to install node modules in an OS X bash environment. Or tools like Homebrew + Cask as well, I use both ways.
Windows sorta has a Homebrew'ish like that called Chocolatey which is a Nuget based package manager via command-line that attempts to mimic something like the popular Homebrew in OS X.
With package managers you can do all sorts of cool things such as install stuff in 2 seconds rather than go out to the net for executables. For example one can do this to install a bunch of common programs you might use in your development environment:
choco install google-chrome-x64
choco install firefox
choco install git.install
choco install atom
choco install 7zip
choco install ccleaner
choco install node.js
choco install filezilla
choco install fiddler
choco install virtualbox
choco install pdfcreator
choco install windirstat
choco install itunes
and because you're using a package manager and its commands, that means you can automate creating your development environment too by creating a chocolately script or HomeBrew script or whatever.
Imagine creating a script that you could run on a fresh install of windows that does a bunch of chocolatey commands (or equiv of Homebrew in OS X) to install and setup your entire local dev environment. Sure would save a hell of a lot of time. Especially if you haven't imaged your laptop the last time you went through the pain of setting up our dev environment manually. When i say manually, meaning do the typical go to the web, go to FireFox, Google, and other sites to manually click all over and download and then run the exe, stupid wizards, all that. You can bypass a lot of that hassle and save time by creating scripts along with using Chocolatey or HomeBrew and automate most of the things you use as a developer.
I use Powershell for all that I do. So I'll use PowerShell to install Chocolatey. You can also just use the command prompt but why not just use PowerShell is my argument.
Here is how to install it
There are a couple little pain points that you need to be aware of if you haven't used PowerShell and such while trying to install Chocolatey that you'll come across.
- First, make sure you elevate privileges with PowerShell to allow the Chocolately script to be run on your comptuer
Run the command Set-ExecutionPolicy RemoteSigned
2. Install Chocolatey
Run the command:
ex ((new-objec net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
3. Start using it
Here I'm installing Git for Windows with a simple Chocolatey command:
So simple. Now it's installed. Note that there are many Git packages up on the Chocolatey website. This one installs Git and then you can start making Git commands right from PowerShell thereafter:
This is not installing something like Mysis Git Bash prompt. If you want something like MysisGit, if there isn't a package that does that for you in the Chocolatey Packages directory listing then you'd have to go manually install it yourself.
You can also quickly install stuff like Chrome which will do everything you expect..pulls down the Chrome executable runs it and installs it for you without you needing to do a thing. All you have to do is type choco install google-chrome-x64
This just scratches the surface. Windows 10 is coming out with their own built-in Package Manager finally. We'll see if it's any good.