DEV Community

Cover image for Getting Started With Chocolatey 🍫
Stephan Lamoureux
Stephan Lamoureux

Posted on • Updated on

Getting Started With Chocolatey 🍫

Chocolatey is a command-line package manager like homebrew or APT, but for Windows.

Requirements

  • Windows 7+
  • PowerShell
  • .NET Framework 4+ (the installer will install .NET if you do not have it)

🧑‍💻 Admin Shell

Before we start the installation process, I want to cover launching an administrative shell from windows. There are a few ways to do this:

  • Option 1

Right-click on the Windows start menu and select Windows Terminal (Admin):

Right clicked Windows start menu
Once your terminal loads, click the ˅ icon and open a new PowerShell tab. It should say Administrator: Windows PowerShell in the new tab:

Admin PowerShell

  • Option 2

If you have Windows Terminal on your taskbar, Shift + Right-Click on the icon and select run as administrator, and then open a new PowerShell tab:

Right click windows terminal icon

  • Option 3

Use the search bar from the Start menu and type in powershell. A link to Run as Administrator will display:

Search PowerShell from the start menu

  • Option 4

Windows Terminal added a new feature where you can launch a PowerShell/Command Prompt profile in an Admin terminal automatically. In the Windows Terminal settings, scroll down to your desired profile and then toggle the Run this profile as Administrator switch. Now you can skip all the steps above, and the terminal will always launch as admin.

Image description


🍫 Installing Chocolatey

  • 1. Open an administrative PowerShell terminal and run the following command:
Get-ExecutionPolicy
Enter fullscreen mode Exit fullscreen mode
  • 2. If it returns Restricted, then run one of the following commands:
Set-ExecutionPolicy AllSigned
Enter fullscreen mode Exit fullscreen mode

or

Set-ExecutionPolicy Bypass -Scope Process
Enter fullscreen mode Exit fullscreen mode

With PowerShell, 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.

  • 3. Finally, run the following command:
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'))
Enter fullscreen mode Exit fullscreen mode

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.


⌨️ Basic Commands

We use the choco command to run chocolatey. (Remember, you must use an administrative shell for it to work.)

Install a new package:

choco install filename
Enter fullscreen mode Exit fullscreen mode

Remove a package:

choco uninstall filename
Enter fullscreen mode Exit fullscreen mode

List all of the installed packages:

choco list
Enter fullscreen mode Exit fullscreen mode

Update:

choco upgrade filename
Enter fullscreen mode Exit fullscreen mode

or to update everything at once:

choco upgrade all
Enter fullscreen mode Exit fullscreen mode

📱 App Recommendations

Search for available apps on the Community Package Repository.

Here are a few of my favorite (free) apps for productivity and development on Windows:

  • Wox - A full-featured launcher
  • RunJs - JavaScript and TypeScript playground
  • Responsively - A modified web browser that helps in responsive web development.
  • Zeal - the Windows version of Dash
  • Figma - A collaborative UI design tool
  • draw.io - Flowchart maker and diagram software
  • GitHub Desktop - A GUI for Git
  • Postman - API tools
  • Notion - Project management and note-taking software
  • Microsoft PowerToys - A set of utilities for power users

You can download all these at once with the following command using chocolatey in an admin shell:

choco install wox runjs responsively zeal figma drawio github-desktop postman notion powertoys -y
Enter fullscreen mode Exit fullscreen mode

References

Top comments (0)