Chocolatey Install Windows

On

Installing and upgrading software has always been a tedious task. For end users, you begin with getting the software followed by downloading and installation.

  1. Chocolatey Install Windows Store App

Chocolatey works with all existing software installation technologies like MSI, NSIS, InnoSetup, etc, but also works with runtime binaries and zip archives. Go Pro/Business to dial that experience up to 11! Easily manage all aspects of Windows software (installation, configuration, upgrade, and uninstallation). Chocolatey is the most reliable when software is included in the package, but can also easily download resources. Chocolatey was born out of providing automation for Windows and doing that with packages, packages that could surround an installer but didn’t necessarily need to. The Chocolatey install scripts use the Chocolatey package (a nupkg file itself) to be installed and upgraded as just another package. If you specified a particular version and are receiving this message, it is possible that the package name exists but the version does not. Version: ' Source(s): 'windowsfeatures' Chocolatey installed 0/2 packages. 2 packages failed. See the log for details (C: ProgramData chocolatey logs chocolatey.log).

It is a seemingly smoother process on Linux via the command-line (think apt-get), where few commands install or update software (of course, you still need to find what you need to install). This command line interface is now available for Windows users via the oddly named Chocolatey package manager.

Chocolatey NuGet?

The many options for Windows package or software management can be confusing. NuGet is a package management system for developers — that is, it handles packages and references for projects, thus allowing the developer to concentrate on code.

While NuGet handles packages, Chocolatey handles applications at a system level. So, you would use Chocolatey to install an application such as Puppet on your development machine. It appears Chocolatey is becoming the de facto standard for Windows package and dependency management, but it still is not a standard Windows component.

Chocolatey

Getting Chocolatey

Chocolatey uses PowerShell along with the NuGet packaging format. (You'll need to set up PowerShell before reaching for Chocolatey.) To install Chocolatey, open a command prompt and enter the following command:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command 'iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))' && SET PATH=%PATH%;%systemdrive%chocolateybin

  • -NoProfile: This switch suppresses custom profiles to avoid installation conflicts.
  • -ExecutionPolicy: You're downloading code via the internet, so execution policy is set to unrestricted to allow the download.
  • -Command: This is the download command of Chocolatey. The command is enclosed in double quotes.
  • SET PATH: This adds Chocolatey to the system path, so you can run it from anywhere on the system.

Chocolatey can be installed via NuGet, and it is available as a NuGet package. Once installed, you can use the help switch to get an idea of how to use Chocolatey. Figure A shows a portion of the information returned by the help command (chocolatey /?).

Figure A

Using the help command line switch to get details on Chocolatey usage.

Chocolatey goodness

With Chocolatey installed, you can use it to install software on your machine via two commands:

  • cinst (chocolatey install): This command is used to install software packages. The install command has a number of additional options and command line switches; a complete list is available online.
  • cuninst (chocolatey uninstall): This command is used to uninstall software packages. It currently supports one optional command line switch to specify the version to uninstall.

The Chocolatey sites provides a gallery of currently available software, and you can easily add your own packages (this requires site registration). The following command installs Firefox on my machine:

cinst Firefox

This kicks off a silent install, so there's no need to do anything else. Figure B shows the results of the command.

Chocolatey install windows 10

Figure B

The following command will remove Firefox from your system:

cuninst Firefox

Once software is installed, you will need or want to keep it updated. The update (or cup) command allows you to quickly update an existing package to the latest version if there is one. The following command(s) demonstrate updating our Firefox installation:

chocolatey update Firefox - or - cup Firefox

The chocolatey command can be shortened to choco, so the previously listed update command could be typed as:

choco update Firefox

Chocolatey Install Windows Store App

Maintaining software is the gist of Chocolatey, but basic installs are only the tip of the iceberg, as it offers more advanced commands for working with Windows components and settings, as well as integrating with Ruby Gems, Python, and more. The WindowsFeatures option allows you to install Windows options via the Deployment Image Servicing and Management tool on the local machine. The following command installs the Telnet client:

choco WindowsFeatures TelnetClient

The online documentation provides more information on the WindowsFeatures option and everything else available.

Tasks like setting a new machine (installing all necessary software) come to mind with a tool like Chocolatey. With Chocolatey installed on your machine, you can use it and its commands with scripts to streamline updates or installations. In addition, there are add-on tools such as Boxstarter that use Chocolatey packages to set up new environments. You can browse the online gallery to get an idea of what else is available via Chocolatey. In addition, the list and search commands can be used to get a list of available software via the command line. The following command lists everything available:

choco list

The next command finds everything with 'ftp' in its name:

choco list ftp - or - choco search ftp

Final thoughts

While Chocolatey is not a tool for everyday users, it is a great utility for techies who want a quick and dirty way to install software. Since first discovering Chocolatey, I have jumped on the bandwagon, and I have used it to keep my collection of machines up and running.

Chocolatey is hosted on GitHub, so you can contribute to its development if inclined. Its Google Group is a great resource as well.

I have not seen official announcements from Microsoft about Chocolatey, though the company's recent unveiling of OneGet shows that it's embracing the package manager. Chocolatey is currently the only repository for OneGet (I am sure more will follow).

Are you using Chocolatey? If so, do you think it's a simpler approach to software installation? If not, do you plan to give it a try? Let us know in the discussion.

Requirements

  • Windows 7+ / Windows Server 2003+
  • PowerShell v2+ (Not PowerShell Core yet though)
  • .NET Framework 4+ (the installation will attempt to install .NET 4.0 if you do not have it installed)

That's it! All you need is choco.exe (that you get from the installation scripts) and you are good to go! No Visual Studio required.

Installing Chocolatey

Chocolatey installs in seconds. You are just a few steps from running choco right now!

  1. First, ensure that you are using an administrative shell - you can also install as a non-admin, check out Non-Administrative Installation.
  2. Copy the text specific to your command shell - cmd.exe or powershell.exe.
  3. Paste the copied text into your shell and press Enter.
  4. Wait a few seconds for the command to complete.
  5. If you don't see any errors, you are ready to use Chocolatey! Type choco or choco -? now, or see Getting Started for usage instructions.

NOTES:

  • If you are behind a proxy, please see Installing behind a proxy.
  • Need completely offline solution? See Completely Offline Install.
  • Installing the licensed edition? See install licensed edition.
  • More Options / Troubleshooting

Install with cmd.exe

Run the following command:

Install with PowerShell.exe

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 -Scope Process.
  • Now run the following command:

Additional considerations

NOTE: Please inspect https://chocolatey.org/install.ps1 prior to running any of these scripts to ensure safety. We already know it's safe, but you should verify the security and contents of any script from the internet you are not familiar with. All of these scripts download a remote PowerShell script and execute it on your machine.

We take security very seriously. Learn more.

More Install Options

Install from PowerShell v3+

Chocolatey Install Windows

With PowerShell, there is an additional step or two. 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.
  • Now run the following command:

Completely offline install

With completely offline use of Chocolatey, you want to ensure you remove the default community package source (choco source list followed by choco source remove -n chocolatey, or however you would do that with a configuration manager like Puppet).

  1. The first step with offline is to obtain a copy of the Chocolatey Nupkg (nupkg files are just fancy zip files). Go to https://chocolatey.org/packages/chocolatey and find a version you want.
  2. Click on Download to download that version's nupkg file.
  1. You can also download the latest version directly.
  2. You can put the chocolatey.nupkg on an internal package repository and then address that full path, similar to how you see in the Puppet provider - https://forge.puppet.com/puppetlabs/chocolatey#manage-chocolatey-installation
  3. Then you would run a script similar to the below to address that local install. If it is on a repository somewhere, you will need to enhance the below script to get that file (the Chocolatey Puppet provider install script shows that).

Install with Puppet

NOTE: If you have the licensed edition, see Setting up Licensed Edition with Puppet instead. This only additionally contains some package examples and setting up tab completion.

Here's an example of setting Chocolatey up with Puppet that sets up and configures Chocolatey, sets up an internal package repository, and shows setting up the licensed edition and ensuring some packages.

  • Download the chocolatey.nupkg from the community repository - download the latest chocolatey nupkg or see Completely offline install to get an older version.
  • Optionally download the chocolatey.server package from the community repository - download the latest chocolatey.server nupkg.
  • Use choco push to push those items to your internal package repository (e.g. choco push chocolatey.0.10.7.nupkg -s http://internal_repo/ -k abc123)
  • Determine how to get the bare url to download the Chocolatey.Nupkg directly. You will need that for the internal url for installing Chocolatey offline. For the community repository, it is https://chocolatey.org/api/v2/package/chocolatey

Install using PowerShell from cmd.exe

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.

Create a file named installChocolatey.cmd with the following:

You can also get to this file by going to https://chocolatey.org/installchocolatey.cmd.

If you prefer to have the install.ps1 file already, comment out the download line in the batch file and download the install.ps1 from chocolatey.org and save it as install.ps1 next to the installChocolatey.cmd file.

Run installChocolatey.cmd from an elevated cmd.exe command prompt and it will install the latest version of Chocolatey. You can not run this from powershell.exe without making changes to your execution policy.

NOTE: To create and save a .cmd file, please use a text editor and nothing fancy like Microsoft Word or OneNote.

Install using NuGet Package Manager

When you have Visual Studio 2010+ and the NuGet extension installed (pre-installed on any newer versions of Visual Studio), you can simply type the following three commands and you will have Chocolatey installed on your machine.

Install-Package chocolateyInitialize-ChocolateyUninstall-Package chocolatey

Install using NuGet.exe from PowerShell

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

Install downloaded NuGet package from PowerShell

You can also just download and unzip the Chocolatey package (.nupkg is a fancy zip file):

  1. Download the Chocolatey package.
  2. Ensure the downloaded nupkg is not blocked.
  3. Unzip it using any application that supports zip format.
  4. Open a PowerShell command shell and navigate into the unzipped package's tools folder.
  5. NOTE: Ensure PowerShell execution policy is set to at least bypass or remote signed (if you have issues, you may need to set it to Unrestricted).
  6. Call & .chocolateyInstall.ps1 to allow Chocolatey to install.
  7. NOTE: This will not set Chocolatey as an installed package, so it may be a good idea to also call choco upgrade chocolatey -y and let it reinstall the same version, but at least it will be available for upgrades then.

Install licensed edition

Please see installation of licensed edition.

Installing behind a proxy

Have a proxy? Try

  • Cmd.exe:
  • PowerShell.exe (Ensure Get-ExecutionPolicy is at least RemoteSigned):

Installing behind an explicit proxy

See Installing Chocolatey Behind a Proxy Server

Installing to a different location

  1. Create a machine level (user level will also work) 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).
  2. Don't use 'C:Chocolatey' unless necessary.
  3. Create the folder manually.
  4. If you have already installed (and want to change the location after the fact):
  • Follow the above steps.
  • Install Chocolatey again.
  • Copy/Move over the items from the old lib/bin directory.
  • Delete your old install directory.

NOTE: There is one really important consideration when installing Chocolatey to a non-default location: Chocolatey only locks down the permissions to Admins when installed to the default location %PROGRAMDATA%Chocolatey, which means the same thing as %SystemDrive%ProgramDataChocolatey.If you are installing to another location, you will need to handle this yourself, i. e. restrict write access to Admins in case you so desire.This is due to alternative locations could have a range of permissions that should not be changed.See Why does Chocolatey install where it does and https://github.com/chocolatey/choco/issues/398 for more details.

Installing a particular version of Chocolatey

Set the following environment variable prior to install:

  • chocolateyVersion - controls what version of Chocolatey is installed

In PowerShell, it looks like this:

NOTE: This will only work with the installation methods that call https://chocolatey.org/install.ps1 as part of the install.

Use Windows built-in compression instead of downloading 7zip

Set the following environment variable prior to install:

  • chocolateyUseWindowsCompression - this will bypass the download and use of 7zip.

In PowerShell, it looks like this:

NOTE: This will only work with the installation methods that call https://chocolatey.org/install.ps1 as part of the install.

Installing with restricted TLS

NOTE: If your server is restricted to TLS 1.1+, you need to add additional logic to be able to download and install Chocolatey (this is not necessary when running Chocolatey normally as it does this automatically). If this is for organizational use, you should consider hosting the Chocolatey package internally and installing from there. Otherwise, please see this section.

If you see an error that looks similar to the following:

It's possible that you are attempting to install from a server that needs to use TLS 1.1 or TLS 1.2 (has restricted the use of TLS 1.0 and SSL v3), you have some options.

Option 1

If you have the following:

  • PowerShell v3+
  • .NET Framework 4.5

You can just run the following instead of just the one-liner to get Chocolatey installed:

Option 2

You need to download and unzip the Chocolatey package, then call the PowerShell install script from there. See the Download + PowerShell Method section below.

Non-Administrative install

NOTE: This option should be a last resort and is considered to be a more advanced scenario - most things you do on Windows require administrative rights, especially surrounding software management, so you are going to be limited even in packages you attempt to install. If you are using the community package repository, there are over 200 packages you can install from the community repository without administrative permission - see https://chocolatey.org/packages?q=id%3Aportable+tag%3Aportable.

  1. You must choose a different location than the default (see Installing to a different location above). The default is a more secure location that only administrators can update.
  2. Follow that with the command line / PowerShell methods of installation.
  3. Here is an example of this.

NonAdmin.ps1:

If you prefer or need cmd.exe example, please see https://gist.github.com/ferventcoder/78fa6b6f4d6e2b12c89680cbc0daec78

Upgrading Chocolatey

Once installed, Chocolatey can be upgraded in exactly the same way as any other package that has been installed using Chocolatey. Simply use the command to upgrade to the latest stable release of Chocolatey:

Uninstalling Chocolatey

See uninstall.

FAQs

I'm having trouble installing Chocolatey

Make sure you've reviewed More Install Options and looked over Troubleshooting. If you've done those things, reach out over the mailing list or over the chat (Gitter). The links to those can be found in the open source section of https://chocolatey.org/support.

I'm getting a 403 attempting to install

This is addressed in Troubleshooting.

Why isn't there an MSI?

tl;dr - Chocolatey installs as a nupkg like everything else, a PowerShell install script just ensures that.

Chocolatey was born out of providing automation for Windows and doing that with packages, packages that could surround an installer but didn't necessarily need to. The Chocolatey install scripts use the Chocolatey package (a nupkg file itself) to be installed and upgraded as just another package. This means Chocolatey is 'eating its own dogfood' and it is unlikely we'd offer it as an MSI (native installer)as it would fly a bit in the face of what Chocolatey represents (although it is something that we would not rule out).

The installation actually ensures a couple of things:

  • PowerShell is installed and is set up properly.

    PowerShell is a requirement for using Chocolatey, not just for install. It is what drives the package installation process in most cases. Every package can have binaries and/or installation/uninstallation scripts (written in PowerShell). Chocolatey is the framework and each package gets to define how it is installed, upgraded, and uninstalled. It's an extremely flexible framework that has been proven to meet the insanity that is the Windows software installation ecosystem. That flexibility would not be easily achieved without PowerShell.

    We do recognize there are a few organizations that disable PowerShell, so it's very likely in the future our Business Edition will meet that need. PowerShell is a staple of Windows automation, so it is not the norm for an organization in this day and age to disable PowerShell.

    Having an install process that uses PowerShell helps you determine quickly if Chocolatey will be able to be used in your environment.

    • Search for mods on the. Nexus mod manager skyrim download. • Carefully read through the description of each mod. • Choose the Files tab.

  • You are open to doing things in a slightly different way, e.g. working with packages as opposed to installers.

    You are open to the concept of using packages. Some folks might say this means we are asking folks to learn to 'do things 'our way' because we know better'. It's less about 'knowing better' and more about learning that Chocolatey does things in a slightly different way. It does that because the world of software is not just installers. Software goes beyond Programs and Features and a system that can track all of that also needs to as well. Package management is not a new concept in the world of software, perhaps just newer to Windows. If folks are not open to that, then they are probably not going to be open to Chocolatey. And that's completely fine. Chocolatey is not for everyone. We may eventually get to more of a masses approach. Right now we are targeting a specific type of audience - those that are looking for better ways to manage software on Windows and open to looking for the best process of doing that.