What is Chocolatey?
Chocolatey is a package manager for Windows that simplifies the installation, updating, and management of software applications and command-line tools. Similar to Homebrew on macOS, Chocolatey allows users to automate software installations using a single command.
Checking Your PowerShell Execution Policy
Before installing Chocolatey, ensure that your PowerShell execution policy allows scripts to run. Open PowerShell as an administrator and check the current policy:
Get-ExecutionPolicy
If it returns Restricted
, change it to AllSigned
or Bypass
temporarily:
Set-ExecutionPolicy Bypass -Scope Process -Force
This allows Chocolatey to run its installation scripts without restrictions.
Installing Chocolatey
Step 1: Open PowerShell as Administrator
- Press
Win + X
and select Windows Terminal (Admin) or PowerShell (Admin).
Step 2: Run the Installation Command
Copy and paste the following command into the terminal:
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'))
- Press Enter and wait for Chocolatey to install.
- Close and reopen PowerShell to apply changes.
Step 3: Verify Installation
Run the following command to confirm Chocolatey is installed:
choco -v
If Chocolatey is installed correctly, it will return the installed version number.
Installing Git Using Chocolatey
Installing Git via Chocolatey ensures you always have the latest version and simplifies updates.
choco search git # Search for Git choco install git -y # Install Git without confirmation prompt
Verify Installation
git --version # Check Git version where.exe git # Locate Git installation
Installing Software with Chocolatey
Chocolatey provides two package types:
- Standard Packages (CLI tools like
git
,nodejs
) - GUI Applications (Apps like
Google Chrome
,VS Code
)
Installing a CLI Package
choco install nodejs -y # Install Node.js
Installing a GUI Application
choco install googlechrome -y # Install Google Chrome
The
-y
flag skips confirmation prompts.
Managing Chocolatey Packages
Listing Installed Packages
choco list --local-only # View installed packages
Upgrading Installed Packages
choco upgrade all -y # Upgrade all installed packages
Uninstalling a Package
choco uninstall <package-name> -y # Remove a specific package
Running Chocolatey in Scripts
To automate installations in scripts, use Chocolatey commands within .ps1
files. Example:
# Install multiple applications choco install git vscode nodejs googlechrome -y
Run the script in an elevated PowerShell session to execute commands.
Chocolatey GUI: A Visual Interface
For users who prefer a graphical interface, install Chocolatey GUI:
choco install chocolateygui -y
Run Chocolatey GUI from the Start Menu to manage software visually.
Uninstalling Chocolatey
If you need to remove Chocolatey, run:
choco uninstall chocolatey -y
Then manually delete the C:\ProgramData\chocolatey
folder to clean up residual files.
Exploring More Chocolatey Commands
choco help # View available commands choco info <package-name> # Get package details choco outdated # Check for outdated packages
For a full package list, visit Chocolatey Community Repository.
Chocolatey simplifies Windows package management, making software installations fast and efficient! 🚀
Top comments (0)