Table of Contents
Chocolatey is a Windows counterpart to the Linux apt package manager or yum package manager. The software offers a CLI-based package installation and management in Windows with the community-maintained package repository.
Chocolatey is a command-line package manager and installer for Windows operating systems. With the NuGet packaging infrastructure and the Windows PowerShell technology at its core, Chocolatey simplifies and automates the process of installing software and keeping it up to date.
Prerequisites
- Windows 7+/Windows 2003+ (including Server Core, but excluding Windows Nano Server).
- .NET Framework 4.x+.
- A user account with administrator privileges.
Install Chocolatey on Windows 10
There are two ways to install Chocolatey on Windows 10:
- Using the Command Prompt.
- Using Windows PowerShell.
Both installations require an account with administrative shell access.
Method 1: Install Chocolatey via Command Prompt
1. Press the Windows key and type cmd. Right click then select the Run as administrator.
2. Run the following command:
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Wait for the installation process to finish to start using Chocolatey. Once done. close then reopen CMD then run choco command to verify it works.
C:\WINDOWS\system32>choco
Chocolatey v1.1.0
Please run 'choco -?' or 'choco <command> -?' for help menu.
Method 2: Install Chocolatey via PowerShell
Installing Chocolatey via PowerShell involves an additional step compared to installing via the Command Prompt. Follow the steps below to install Chocolatey using Windows PowerShell:
1. Right click on the Windows start icon then select Windows PowerShell Admin.
2. Copy then paste all below commands into the PowerShell window to download and install Chocolatey
#Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force `
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 `
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
PS C:\WINDOWS\system32> choco
Chocolatey v1.1.0
Please run 'choco -?' or 'choco <command> -?' for help menu.
Get the list of Chocolatey commands using choco –help command.
PS C:\WINDOWS\system32> choco --help
This is a listing of all of the different things you can pass to choco.
Options and Switches
-v, --version
Version - Prints out the Chocolatey version. Available in 0.9.9+.
Commands
* find - searches remote or local packages (alias for search)
* list - lists remote or local packages
* search - searches remote or local packages
* help - displays top level help information for choco
* info - retrieves package information. Shorthand for choco search pkgname --exact --verbose
* install - installs packages using configured sources
* pin - suppress upgrades for a package
* outdated - retrieves information about packages that are outdated. Similar to upgrade all --noop
* upgrade - upgrades packages from various sources
* uninstall - uninstalls a package
* pack - packages nuspec, scripts, and other Chocolatey package resources into a nupkg file
* push - pushes a compiled nupkg to a source
* new - creates template files for creating a new Chocolatey package
* sources - view and configure default sources (alias for source)
* source - view and configure default sources
* config - Retrieve and configure config file settings
* feature - view and configure choco features
* features - view and configure choco features (alias for feature)
* setapikey - retrieves, saves or deletes an apikey for a particular source (alias for apikey)
* apikey - retrieves, saves or deletes an apikey for a particular source
* unpackself - re-installs Chocolatey base files
* export - exports list of currently installed packages
* template - get information about installed templates
* templates - get information about installed templates (alias for template)
Search For a Program
The search command allows users to search for a package locally or remotely. Although search is currently an alias for the list command, starting from version 2.0.0, list will work only for local and installed packages. search and find will be used for remote sources as well.
For example, to search for 7zip packages:
choco search 7zip
PS C:\WINDOWS\system32> choco search 7zip
Chocolatey v1.1.0
2 validations performed. 1 success(es), 1 warning(s), and 0 error(s).
7zip 22.1 [Approved]
7zip-zstd 1.4.9.20 [Approved]
7zip.commandline 16.02.0.20170209 [Approved]
7zip.portable 22.1 [Approved]
tcp-7zip 0.7.6.6 [Approved]
7zip.install 22.1 [Approved]
winmerge-7z 0028.465.920 [Approved] - Possibly broken
nanazip.portable 1.0.88.0 [Approved] Downloads cached for licensed users
...
30 packages found.
Chocolatey GUI
The GUI app is available in the Chocolatey community repository and allows users to perform most of the tasks available using the CLI. The GUI simplifies the process for users not accustomed to using the CLI.
To install the Chocolatey GUI app, open Windows PowerShell or the Command Prompt as an administrator and run the following command:
choco install chocolateygui
PS C:\WINDOWS\system32> choco install chocolateygui
Chocolatey v1.1.0
Installing the following packages:
chocolateygui
By installing, you accept licenses for the packages.
Progress: Downloading ChocolateyGUI 1.1.0... 100%
Progress: Downloading chocolatey-core.extension 1.4.0... 100%
Progress: Downloading chocolatey-compatibility.extension 1.0.0... 100%
Progress: Downloading dotnetfx 4.8.0.20220524... 100%
Progress: Downloading chocolatey-dotnetfx.extension 1.0.1... 100%
Progress: Downloading KB2919355 1.0.20160915... 100%
Progress: Downloading KB2919442 1.0.20160915... 100%
ChocolateyGUI v1.1.0 [Approved]
chocolateygui package files install completed. Performing other installation steps.
Installing ChocolateyGUI...
ChocolateyGUI has been installed.
Added C:\ProgramData\chocolatey\bin\chocolateygui.exe shim pointed to 'c:\program files (x86)\chocolatey gui\chocolateygui.exe'.
Added C:\ProgramData\chocolatey\bin\chocolateyguicli.exe shim pointed to 'c:\program files (x86)\chocolatey gui\chocolateyguicli.exe'.
chocolateygui may be able to be automatically uninstalled.
The install of chocolateygui was successful.
Software installed as 'msi', install location is likely default.
Chocolatey installed 7/7 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Installed:
- kb2919355 v1.0.20160915
- chocolatey-core.extension v1.4.0
- dotnetfx v4.8.0.20220524
- kb2919442 v1.0.20160915
- chocolateygui v1.1.0
- chocolatey-compatibility.extension v1.0.0
- chocolatey-dotnetfx.extension v1.0.1
Basic Chocolatey Commands
After installing Chocolatey, start with the basic commands, such as searching, installing, or listing installed packages. Run the commands either in Windows PowerShell or in the Command Prompt.
Commands
* find - searches remote or local packages (alias for search)
* list - lists remote or local packages
* search - searches remote or local packages
* help - displays top level help information for choco
* info - retrieves package information. Shorthand for choco search pkgname --exact --verbose
* install - installs packages using configured sources
* pin - suppress upgrades for a package
* outdated - retrieves information about packages that are outdated. Similar to upgrade all --noop
* upgrade - upgrades packages from various sources
* uninstall - uninstalls a package
* pack - packages nuspec, scripts, and other Chocolatey package resources into a nupkg file
* push - pushes a compiled nupkg to a source
* new - creates template files for creating a new Chocolatey package
* sources - view and configure default sources (alias for source)
* source - view and configure default sources
* config - Retrieve and configure config file settings
* feature - view and configure choco features
* features - view and configure choco features (alias for feature)
* setapikey - retrieves, saves or deletes an apikey for a particular source (alias for apikey)
* apikey - retrieves, saves or deletes an apikey for a particular source
* unpackself - re-installs Chocolatey base files
* export - exports list of currently installed packages
* template - get information about installed templates
* templates - get information about installed templates (alias for template)
Install Program
Use the following syntax to install one or multiple packages:
choco install pkg1 pkg2 -y
For example, to install the 7zip package from the default repository, run:
PS C:\WINDOWS\system32> choco install 7zip opera -y
Installing the following packages: 7zip
By installing, you accept licenses for the packages.
Progress: Downloading 7zip.install 22.1... 100%
Progress: Downloading 7zip 22.1... 100%
7zip.install v22.1 [Approved]
7zip.install package files install completed. Performing other installation steps.
Installing 64 bit version
Installing 7zip.install...
7zip.install has been installed.
7zip installed to 'C:\Program Files\7-Zip'
Added C:\ProgramData\chocolatey\bin\7z.exe shim pointed to 'c:\program files\7-zip\7z.exe'.
7zip.install can be automatically uninstalled.
The install of 7zip.install was successful.
Software installed to 'C:\Program Files\7-Zip\'
7zip v22.1 [Approved]
7zip package files install completed.
Update Program
The upgrade command upgrades the specified package or list of packages. If the package is not installed, upgrade installs it instead.
For example, to upgrade the 7zip package, run:
PS C:\WINDOWS\system32> choco upgrade 7zip
Chocolatey v1.1.0
2 validations performed. 1 success(es), 1 warning(s), and 0 error(s).
Upgrading the following packages: 7zip
By upgrading, you accept licenses for the packages.
7zip v22.1 is the latest version available based on your source(s).
Chocolatey upgraded 0/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Add the all flag to the upgrade command to update all installed packages.
choco upgrade all
Not a reader? Watch this related video tutorial: