Table of Contents
Chocolatey Software Package Manager for Windows
Return to Cloud Monk's Package Manager Book, Package Manager for Windows, Package Managers for Windows, Windows Package Managers, Windows Package Manager, Package Manager for macOS, Package Manager for Linux, Package Manager for RHEL, Package Manager for Ubuntu, Package Manager for FreeBSD
Return to GitOps, DevOps deployment, Kubernetes-Docker, Linux configuration (Unix shell initialization - bash profile) Ansible-Terraform, Package manager, Package management, Packages, Configuration, Configuration automation, Deployment automation, Continuous deployment, Delivery, Continuous delivery, Integration, Continuous integration, CI-CD, CI/CD, Version control, GitHub, GitHub Actions, GitHub CLI, AWS Cloud Shell, AWS Tools for PowerShell, Azure Cloud Shell, Azure PowerShell, Google Cloud Shell, Oracle Cloud Shell (Oracle Cloud Infrastructure Cloud Shell), IBM Cloud Shell, Linode Cloud Shell, DigitalOcean Cloud Shell, GitHub Codespaces IDE, AWS Cloud9 IDE, Databricks Cloud Shell, JetBrains, Azure DevOps, JetBrains TeamCity, Management, Configuration management
Chocolatey
Azure
AWS
DevOps
Config Management
-
- Ansible - not available in Chocolatey
Databases
Git
Programming languages
Node.js
Ruby
JDK
C#
JetBrains
PowerShell
Microsoft
Tools
Pentesting
Security
Windows PowerShell Installation
PS C:\WINDOWS\system32> Set-ExecutionPolicy Bypass -Scope Process -Force; iex 1)
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.11.
Downloading 7-Zip commandline tool prior to extraction.
Extracting \Users\USERNAME\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\USERNAM\AppData\Local\Temp\
chocolatey\chocInstall…
Installing chocolatey on this machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib' (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin' and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.
Creating Chocolatey folders if they do not already exist.
WARNING: You can safely ignore errors related to missing log files when upgrading from a version of Chocolatey less than 0.9.9.'Batch file could not be found' is also safe to ignore. 'The system cannot find the file specified' - also safe.
WARNING: Not setting tab completion: Profile file does not exist at 'C:\Users\USERNAME\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or PowerShell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart PowerShell and/or consoles first prior to using choco.
Ensuring chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder
PS C:\WINDOWS\system32> Chocolatey
Install Command
Installs a package or a list of packages (sometimes specified as a
packages.config). Some may prefer to use `[[cinst]]` as a shortcut for `[[choco install]]`.
NOTE: 100% compatible with older chocolatey client (0.9.8.32 and below)
with options and switches. Add `-y` for previous behavior with no prompt. In most cases you can still pass options and switches with one dash (`-`). For more details, see the command reference (`choco -?`).
Usage
- choco install <pkg|packages.config> [<pkg2> <pkgN>] [<options/switches>]
- cinst <pkg|packages.config> [<pkg2> <pkgN>] [<options/switches>]
NOTE: `all` is a special package keyword that will allow you to install
all packages from a custom feed. Will not work with Chocolatey default feed. THIS IS NOT YET REIMPLEMENTED.
NOTE: Any package name ending with .config is considered a
'packages.config' file. Please see https://bit.ly/packages_config
NOTE: Chocolatey Pro / Business builds on top of a great open source
experience with quite a few features that enhance the your use of the community package repository (when using Pro), and really enhance the Chocolatey experience all around. If you are an organization looking for a better ROI, look no further than Business - automatic package creation from installer files, automatic recompile support, runtime malware protection, private CDN download cache, synchronize with Programs and Features, etc - https://chocolatey.org/compare.
Examples
- choco install sysinternals
choco install notepadplusplus googlechrome atom 7zip choco install notepadplusplus --force --force-dependencies choco install notepadplusplus googlechrome atom 7zip -dvfy choco install git --params="'/GitAndUnixToolsOnPath /NoAutoCrlf'" -y choco install nodejs.install --version 0.10.35 choco install git -s "'https://somewhere/out/there'" choco install git -s "'https://somewhere/protected'" -u user -p pass
Choco can also install directly from a nuspec/nupkg file. This aids in
testing packages:
choco installchoco install
Install multiple versions of a package using -m (AllowMultiple versions)
choco install ruby --version 1.9.3.55100 -my choco install ruby --version 2.0.0.59800 -my choco install ruby --version 2.1.5 -my
What is `-my`? See option bundling in the command reference
(`choco -?`).
NOTE: All of these will add to PATH variable. We'll be adding a special
option to not allow PATH changes. Until then you will need to manually go modify Path to just one Ruby and then use something like uru (https://bitbucket.org/jonforums/uru) or pik (https://chocolatey.org/packages/pik) to switch between versions.
See It In Action
Chocolatey FOSS install showing tab completion and `refreshenv` (a way
to update environment variables without restarting the shell).
FOSS install in action: https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/choco_install.gif
Chocolatey Professional showing private download cache and virus scan
protection.
Pro install in action: https://raw.githubusercontent.com/wiki/chocolatey/choco/images/gifs/chocopro_install_stopped.gif
Packages.config
Alternative to PackageName. This is a list of packages in an xml manifest for Chocolatey to install. This is like the packages.config that NuGet uses except it also adds other options and switches. This can also be the path to the packages.config file if it is not in the current working directory.
NOTE: The filename is only required to end in .config, the name is not required to be packages.config.
Alternative Sources
Available in 0.9.10+.
Ruby This specifies the source is Ruby Gems and that we are installing a
gem. If you do not have ruby installed prior to running this command, the command will install that first. e.g. `choco install compass -source ruby`
WebPI This specifies the source is Web PI (Web Platform Installer) and that
we are installing a WebPI product, such as IISExpress. If you do not have the Web PI command line installed, it will install that first and then the product requested. e.g. `choco install IISExpress --source webpi`
Cygwin This specifies the source is Cygwin and that we are installing a cygwin
package, such as bash. If you do not have Cygwin installed, it will install that first and then the product requested. e.g. `choco install bash --source cygwin`
Python This specifies the source is Python and that we are installing a python
package, such as Sphinx. If you do not have easy_install and Python installed, it will install those first and then the product requested. e.g. `choco install sphinx --source python`
Windows Features This specifies that the source is a Windows Feature and we should
install via the Deployment Image Servicing and Management tool (DISM) on the local machine. e.g. `choco install IIS-WebServerRole --source windowsfeatures`
Resources
* How-To: A complete example of how you can use the PackageParameters argument when creating a Chocolatey Package can be seen at https://chocolatey.org/docs/how-to-parse-package-parameters-argument * One may want to override the default installation directory of a piece of software. See https://chocolatey.org/docs/getting-started#overriding-default-install-directory-or-other-advanced-install-concepts.
Options and Switches
NOTE: Options and switches apply to all items passed, so if you are
installing multiple packages, and you use `--version=1.0.0`, it is going to look for and try to install version 1.0.0 of every package passed. So please split out multiple package calls when wanting to pass specific options.
-?, --help, -h Prints out the help menu.
-d, --debug Debug - Show debug messaging.
-v, --verbose Verbose - Show verbose messaging. Very verbose messaging, avoid using under normal circumstances.
--trace Trace - Show trace messaging. Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging. Available in 0.10.4+.
--nocolor, --no-color No Color - Do not show colorization in logging output. This overrides the feature 'logWithoutColor', set to 'False'. Available in 0.10.9+.
--acceptlicense, --accept-license AcceptLicense - Accept license dialogs automatically. Reserved for future use.
-y, --yes, --confirm Confirm all prompts - Chooses affirmative answer instead of prompting. Implies --accept-license
-f, --force Force - force the behavior. Do not use force during normal operation - it subverts some of the smart behavior for commands.
--noop, --whatif, --what-if NoOp / WhatIf - Don't actually do anything.
-r, --limitoutput, --limit-output LimitOutput - Limit the output to essential information
--timeout, --execution-timeout=VALUE CommandExecutionTimeout (in seconds) - The time to allow a command to finish before timing out. Overrides the default execution timeout in the configuration of 2700 seconds. '0' for infinite starting in 0.10.4.
-c, --cache, --cachelocation, --cache-location=VALUE CacheLocation - Location for download cache, defaults to %TEMP% or value in chocolatey.config file.
--allowunofficial, --allow-unofficial, --allowunofficialbuild, --allow-unofficial-build AllowUnofficialBuild - When not using the official build you must set this flag for choco to continue.
--failstderr, --failonstderr, --fail-on-stderr, --fail-on-standard-error, --fail-on-error-output FailOnStandardError - Fail on standard error output (stderr), typically received when running external commands during install providers. This overrides the feature failOnStandardError.
--use-system-powershell UseSystemPowerShell - Execute PowerShell using an external process instead of the built-in PowerShell host. Should only be used when internal host is failing. Available in 0.9.10+.
--no-progress Do Not Show Progress - Do not show download progress percentages. Available in 0.10.4+.
--proxy=VALUE Proxy Location - Explicit proxy location. Overrides the default proxy location of ''. Available for config settings in 0.9.9.9+, this CLI option available in 0.10.4+.
--proxy-user=VALUE Proxy User Name - Explicit proxy user (optional). Requires explicity proxy (`--proxy` or config setting). Overrides the default proxy user of ''. Available for config settings in 0.9.9.9+, this CLI option available in 0.10.4+.
--proxy-password=VALUE Proxy Password - Explicit proxy password (optional) to be used with username. Requires explicity proxy (`--proxy` or config setting) and user name. Overrides the default proxy password (encrypted in settings if set). Available for config settings in 0.9.9.9+, this CLI option available in 0.10.4+.
--proxy-bypass-list=VALUE ProxyBypassList - Comma separated list of regex locations to bypass on proxy. Requires explicity proxy (`--proxy` or config setting). Overrides the default proxy bypass list of ''. Available in 0.10.4+.
--proxy-bypass-on-local Proxy Bypass On Local - Bypass proxy for local connections. Requires explicity proxy (`--proxy` or config setting). Overrides the default proxy bypass on local setting of 'True'. Available in 0.10.4+.
--log-file=VALUE Log File to output to in addition to regular loggers. Available in 0.1- 0.8+.
-s, --source=VALUE Source - The source to find the package(s) to install. Special sources include: ruby, webpi, cygwin, windowsfeatures, and python. To specify more than one source, pass it with a semi-colon separating the values (- e.g. "'source1;source2'"). Defaults to default feeds.
--version=VALUE Version - A specific version to install. Defaults to unspecified.
--pre, --prerelease Prerelease - Include Prereleases? Defaults to false.
--x86, --forcex86 ForceX86 - Force x86 (32bit) installation on 64 bit systems. Defaults to false.
--ia, --installargs, --installarguments, --install-arguments=VALUE InstallArguments - Install Arguments to pass to the native installer in the package. Defaults to unspecified.
-o, --override, --overrideargs, --overridearguments, --override-arguments OverrideArguments - Should install arguments be used exclusively without appending to current package passed arguments? Defaults to false.
--notsilent, --not-silent NotSilent - Do not install this silently. Defaults to false.
--params, --parameters, --pkgparameters, --packageparameters, --package-parameters=VALUE PackageParameters - Parameters to pass to the package. Defaults to unspecified.
--argsglobal, --args-global, --installargsglobal, --install-args-global, --applyargstodependencies, --apply-args-to-dependencies, --apply-install-arguments-to-dependencies Apply Install Arguments To Dependencies - Should install arguments be applied to dependent packages? Defaults to false.
--paramsglobal, --params-global, --packageparametersglobal, --package-parameters-global, --applyparamstodependencies, --apply-params-to-dependencies, --apply-package-parameters-to-dependencies Apply Package Parameters To Dependencies - Should package parameters be applied to dependent packages? Defaults to false.
--allowdowngrade, --allow-downgrade AllowDowngrade - Should an attempt at downgrading be allowed? Defaults to false.
-m, --sxs, --sidebyside, --side-by-side, --allowmultiple, --allow-multiple, --allowmultipleversions, --allow-multiple-versions AllowMultipleVersions - Should multiple versions of a package be installed? Defaults to false.
-i, --ignoredependencies, --ignore-dependencies IgnoreDependencies - Ignore dependencies when installing package(s). Defaults to false.
-x, --forcedependencies, --force-dependencies ForceDependencies - Force dependencies to be reinstalled when force installing package(s). Must be used in conjunction with --force. Defaults to false.
-n, --skippowershell, --skip-powershell, --skipscripts, --skip-scripts, --skip-automation-scripts Skip Powershell - Do not run chocolateyInstall.ps1. Defaults to false.
-u, --user=VALUE User - used with authenticated feeds. Defaults to empty.
-p, --password=VALUE Password - the user's password to the source. Defaults to empty.
--cert=VALUE Client certificate - PFX pathname for an x509 authenticated feeds. Defaults to empty. Available in 0.9.10+.
--cp, --certpassword=VALUE Certificate Password - the client certificate's password to the source. Defaults to empty. Available in 0.9.10+.
--ignorechecksum, --ignore-checksum, --ignorechecksums, --ignore-checksums IgnoreChecksums - Ignore checksums provided by the package. Overrides the default feature 'checksumFiles' set to 'True'. Available in 0.9.9.9+.
--allowemptychecksum, --allowemptychecksums, --allow-empty-checksums Allow Empty Checksums - Allow packages to have empty/missing checksums for downloaded resources from non-secure locations (HTTP, FTP). Use this switch is not recommended if using sources that download resources from the internet. Overrides the default feature 'allowEmptyChecksums' set to 'False'. Available in 0.10.0+.
--allowemptychecksumsecure, --allowemptychecksumssecure, --allow-empty-checksums-secure Allow Empty Checksums Secure - Allow packages to have empty checksums for downloaded resources from secure locations (HTTPS). Overrides the default feature 'allowEmptyChecksumsSecure' set to 'True'. Available in 0.10.0+.
--requirechecksum, --requirechecksums, --require-checksums Require Checksums - Requires packages to have checksums for downloaded resources (both non-secure and secure). Overrides the default feature 'allowEmptyChecksums' set to 'False' and 'allowEmptyChecksumsSecure' set to 'True'. Available in 0.10.0+.
--checksum, --downloadchecksum, --download-checksum=VALUE Download Checksum - a user provided checksum for downloaded resources for the package. Overrides the package checksum (if it has one). Defaults to empty. Available in 0.10.0+.
--checksum64, --checksumx64, --downloadchecksumx64, --download-checksum-x64=VALUE Download Checksum 64bit - a user provided checksum for 64bit downloaded resources for the package. Overrides the package 64-bit checksum (if it has one). Defaults to same as Download Checksum. Available in 0.10.0+.
--checksumtype, --checksum-type, --downloadchecksumtype, --download-checksum-type=VALUE Download Checksum Type - a user provided checksum type. Overrides the package checksum type (if it has one). Used in conjunction with Download Checksum. Available values are 'md5', 'sha1', 'sha256' or 'sha512'. Defaults to 'md5'. Available in 0.10.0+.
--checksumtype64, --checksumtypex64, --checksum-type-x64, --downloadchecksumtypex64, --download-checksum-type-x64=VALUE Download Checksum Type 64bit - a user provided checksum for 64bit downloaded resources for the package. Overrides the package 64-bit checksum (if it has one). Used in conjunction with Download Checksum 64bit. Available values are 'md5', 'sha1', 'sha256' or 'sha512'. Defaults to same as Download Checksum Type. Available in 0.10.0+.
--ignorepackagecodes, --ignorepackageexitcodes, --ignore-package-codes, --ignore-package-exit-codes IgnorePackageExitCodes - Exit with a 0 for success and 1 for non-succes- s, no matter what package scripts provide for exit codes. Overrides the default feature 'usePackageExitCodes' set to 'True'. Available in 0.- 9.10+.
--usepackagecodes, --usepackageexitcodes, --use-package-codes, --use-package-exit-codes UsePackageExitCodes - Package scripts can provide exit codes. Use those for choco's exit code when non-zero (this value can come from a dependency package). Chocolatey defines valid exit codes as 0, 1605, 1614, 1641, 3010. Overrides the default feature 'usePackageExitCodes' set to 'True'. Available in 0.9.10+.
--stoponfirstfailure, --stop-on-first-failure, --stop-on-first-package-failure Stop On First Package Failure - stop running install, upgrade or uninstall on first package failure instead of continuing with others. Overrides the default feature 'stopOnFirstPackageFailure' set to 'False- '. Available in 0.10.4+.
chocolatey
Return to GitHub star ranking for organizations, GitHub star ranking for repositories, GitOps or GitHub
- Snippet from Wikipedia: Chocolatey
Chocolatey is a machine-level, command-line package manager and installer for software on Microsoft Windows. It uses the NuGet packaging infrastructure and Windows PowerShell to simplify the process of downloading and installing software.
The name is an extension on a pun of NuGet (from "nougat") "because everyone loves Chocolatey nougat".
YouTube Videos
Cloud Monk recommends the following YouTube video:
GitHub Tags
External Sites
Main
- chocolatey
Interesting Articles
Support Resources, FAQs, Q&A, Docs, Blogs
Search Engines
Repos and Registries
Courses
Books
Vidcasts-Podcasts
Chocolatey Software Package Manager: Cloud Monk's Package Manager Book, Cloud Monk's Development PC DevOps Automation via Ansible-Chocolatey-PowerShell-Homebrew-DNF-APT, Chocolatey Glossary, Chocolatey Fundamentals, Chocolatey Inventor - Chocolatey Designer: Rob Reynolds, Chocolatey DevOps - Chocolatey WinOps - WinOps, Chocolatey Tools (InstChoco, choco-package-list-backup and choco-cleaner by bcurran3), Boxstarter, Chocolatey Community Package Repository, Idempotent, Chocolatey install (InstChoco), Refreshenv, PowerShell on Windows, Package managers, Windows Package Managers, Windows Configuration Management - Windows Server Configuration Management, Ansible on Windows, Chef on Windows, Puppet on Windows, Debloat, choco-package-list-backup, Choco Cleaner, (navbar_choco - see also navbar_brew, navbar_package_manager)
© 1994 - 2024 Cloud Monk Losang Jinpa or Fair Use. Disclaimers
SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.