Chocolatey is a command-line-based package manager for Windows, providing a seamless way to install, update, and manage software. Just like Homebrew 1for macOS or APT for Linux, Chocolatey allows users to install applications and tools quickly with a single command. It simplifies the process of managing software dependencies, saving both time and effort, especially for developers, system administrators, and power users.
Chocolatey not only automates the installation of traditional Windows applications but also provides access to an ever-growing library of packages, including utilities, programming languages, frameworks, and even server software. This makes it an essential tool for anyone working in Windows environments who seeks to maintain consistent, up-to-date systems with minimal manual intervention.
In addition to its ability to install software, Chocolatey makes it easy to automate software management in scripts, which can be particularly useful in enterprise or large-scale environments. With Chocolatey, you can install software directly from the command line, script software deployments, and ensure that software stays updated with minimal effort.
What is Chocolatey?
Chocolatey is a package manager for Windows that allows you to automate the installation and management of software packages. With Chocolatey, you can install, update, and uninstall software directly from the command line, using simple commands like choco install <package>
and choco upgrade <package>
. It’s an open-source project that integrates seamlessly with Windows, allowing users to access thousands of software packages from the communitty repository.
Prerequisites
Before installing Chocolatey, ensure you have the following:
- A Windows Server.
- Administrative access to the system.
- PowerShell 2version 3.0 or newer.
Steps to install Chocolatey
1: Open PowerShell as Administrator
- Click the Start menu.
- Type PowerShell in the search bar.
- Right-click on Windows PowerShell and select Run as Administrator.
Note: Administrator privileges are required to install Chocolatey.
2: Install Chocolatey
Run the following command to install Chocolatey.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.WebClient]::new().DownloadString('https://community.chocolatey.org/install.ps1') | Invoke-Expression
This command,
- Bypasses the execution policy temporarily.
- Downloads and runs the Chocolatey installation script.
If the installation is completed you can see as below in the screen.
Chocolatey CLI (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.
Verify Chocolatey Installation
After the installation completes, verify Chocolatey by typing the following command in PowerShell or Command Prompt.
choco -?
Why we add Chocolatey on Windows?
Adding Chocolatey to Windows simplifies the process of managing software installations, updates, and dependencies through a powerful command-line interface. Its default repository, the Chocolatey Community Repository (CCR), offers a vast array of free and trusted software packages, making it easy to install applications ranging from developer tools to everyday utilities with just a single command. By leveraging CCR, users can avoid manual downloads, reduce errors, and maintain consistent software versions across systems. With its integration into scripts and deployment workflows, Chocolatey is an invaluable tool for automating and streamlining software management on Windows.
How to use Chocolatey on Windows?
Once chocolatey is installed on windows, you can manage software package from command line. Below are some common commands to manage the Chocolately in Windows.
Search a Package
Find available packages in CCR3. Search a particular package name using below command.
choco search <package name>
Install Package
To install a package you can use below command.
choco install <package name>
Upgarde a Package
You can also upgrade a particular command in Windows via choco. For this you can use the below command.
choco update <package name>
Uninstall a Package
Below command allows you to unistall a particular package via chocolatey in Windows.
choco uninstall <package name>
What is ‘’ Get-ExecutionPolicy restricted’’ error while installing Chocolatey?
The “Get-ExecutionPolicy Restricted” error occurs during Chocolatey installation when the PowerShell execution policy is set to “Restricted,” which prevents the execution of any scripts, including the one required for installing Chocolatey. PowerShell’s execution policy is a security feature that controls how scripts are executed on your system. To resolve this error, you need to change the execution policy to a less restrictive setting, such as “RemoteSigned,” using the following command.
Set-ExecutionPolicy AllSigned
Conclusion
Installing Chocolatey on Windows is a straightforward process that opens up numerous possibilities for managing software installations and updates efficiently. By following this guide, you’ll have Chocolatey set up and ready for use in minutes.
Also Read: