Skip to content
This repository

Installing Chocolatey

Chocolatey installs in seconds...

There are a few ways to install chocolatey. Chocolatey exists as a nuget package so virtually any way you can get a nuget package, you have the opportunity to then install it.

If you have Visual Studio 2010 and the NuGet extension installed, perhaps the quickest method is to use NuGet Package Manager. Three commands in succession and you are done. See below.

Why does chocolatey install where it does by default?

Great question - why chocolatey installs where it does

Before You Install

Can I install chocolatey to another location? Yes

  1. Create a user environment variable named ChocolateyInstall and set it to the folder you want chocolatey to install to prior to installation (this environment variable must be set globally or available to PowerShell- it is not enough to simply make it available to your current command prompt session). Keep in mind the restrictions though!
  2. Create the folder manually.
  3. If you have already installed (and want to change the location after the fact):
    • Follow the above steps.
    • Install chocolatey again.
    • Copy over the items from the old install directory. (not sure this is true anymore, need someone to verify) (Well you're gonna want to in order to remove the clutter from the root. ~Rs)
    • Delete your old install directory.

Command Line

This really is the easiest method because it requires no configuration of powershell prior to executing it. Open a command line, paste the following 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

PowerShell

This is the second easiest method. Open a powershell command line and paste in the following and press <Enter>:

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

Note: You must have your execution policy set to unrestricted (or at least in bypass) for this to work (Set-ExecutionPolicy Unrestricted). There have been reports that RemoteSigned is enough for the install to work.
It downloads and runs (https://chocolatey.org/install.ps1).

PowerShell Through Batch Method

NOTE: This method will give you a deprecated warning. This is the best method if you want to repeat it or include it in source control. It requires no change to your existing powershell to allow for remote unsigned scripts.

Download the two items from chocolateyInstall.

Run installChocolatey.cmd and it will install and update to the latest version of chocolatey.

NuGet Package Manager Method

When you have Visual Studio 2010 and the NuGet extension installed, you can simply type the following three commands and you will have chocolatey installed on your machine.

Install-Package chocolatey
Initialize-Chocolatey
Uninstall-Package chocolatey

NuGet.exe + PowerShell Method

You can also use nuget command line to download chocolatey:

nuget install chocolatey or nuget install chocolatey -pre

Once you download it, open powershell (remote unsigned), navigate to the tools folder and run:

& 'chocolateyInstall.ps1'

Something went wrong with that request. Please try again.