How to Install winget (Windows Package Manager)

Introduction

winget is an open-source Windows package manager designed by Microsoft for Windows 10 and Windows 11. The client installs and manages applications using a CLI, similar to the apt package manager in Linux.

In this tutorial, you will learn to install and use the winget package manager for Windows.

How to install and use winget on Windows.

Prerequisites

  • A computer running Windows 10 or 11.
  • Administrator privileges.
  • A network connection.

How to Install winget

There are two ways to install winget:

  • From the Microsoft Store.
  • Manually, using a package installer from GitHub.

Note: The winget client requires Windows 10 1809 (build 17763) or newer. Windows Server 2019 isn't supported because the Microsoft Store and other dependencies are not available for Windows Server.

If you are already running Windows 10 1809 or newer, the client may already be available on your system. Check if winget is available by invoking the winget command in the Command Prompt or PowerShell:

1. Open the Windows Start menu, type powershell, and press Enter.

Open the Windows PowerShell app.

2. In the PowerShell, run winget to check if the app is installed:

Winget not found error.

In the example above, invoking the command states that winget is not recognized, which means it isn't installed on the system.

Method 1: Install winget via Microsoft Store

Follow the steps below to install winget from the Microsoft Store:

1. Open the Windows Start menu, type store, and press Enter to open the Microsoft Store app.

Open the Microsoft Store app.

2. In the search bar, type winget and press Enter. In the results, click the App Installer application.

Search for winget in the Microsoft Store.

Note: The winget client is distributed within the App Installer package.

3. On the App Installer page, click Get to install the app.

Install winget using the Microsoft Store.

Wait for the installation to finish.

4. Verify the installation by invoking winget in Windows PowerShell or the Command Prompt:

Running winget in Microsoft PowerShell.

The command prints the program version, syntax, and available options.

Method 2: Install winget via GitHub

Another way to install winget is by downloading the installer from GitHub. Follow the steps below:

1. Navigate to the winget GitHub page.

2. Under the Releases section, click the latest available release.

Microsoft's winget GitHub page.

3. On the Version page, scroll down to the Assets section and click the .msixbundle file to start the download.

Download the latest winget version from GitHub.

4. Run the downloaded file and click Update:

Installing winget using the GitHub installer.

Wait for the installation process to finish. The app may automatically install additional dependencies required for winget to work.

5. Verify the installation by running winget in PowerShell or Command Prompt.

How to Use winget

The winget client allows you to search, install, update, and remove packages. This section shows how to manage packages with winget.

The first time you use winget, a prompt appears asking if you agree to Microsoft's transaction terms. This is because the Microsoft Store repository requires your geographic region to function correctly.

Read the terms, and if you agree, type y and press Enter to confirm.

Install Packages

Install a package with winget using the following syntax:

winget install [package_name]

For [package_name], specify the exact application ID. In the following example, we instruct winget to install Notepad++, and winget prompts for the app ID since Notepad++ is available in two repositories.

Winget prompts for the exact app name for installation.

After specifying the exact application ID, winget automatically downloads and installs Notepad++.

Installing an app using winget.

Search for Packages

Use winget to search for available packages in the public Windows Package Manager Community repository or in the Microsoft Store. The syntax is:

winget search [package_name]

In the following example, we search for the MySQL server:

Searching for available packages in winget.

The output is a list of all available packages containing the mysql keyword.

Show Package Details

Display information about installed packages using the following command:

winget show [package_name]

For example:

Obtaining a package's details using winget.

The output shows the specified app information, including the program version, publisher, author, and program description.

Manage Sources

winget installs packages from online repositories. The two official winget repositories are:

  • msstore. The Microsoft Store repository.
  • winget. The winget software repository maintained by Microsoft.

Use the winget source command to add, remove, list, or update the repositories.

1. List Repositories

See which repositories winget is using by running:

winget source list
Getting a list of repositories winget uses for package management.

The output shows a list of repositories currently in use.

2. Add Repository

Add a third-party repository to winget using the add subcommand. The syntax is:

winget source add --name [name] [url]

For [name], specify the name you want for the repository, and for [url], specify the repository URL.

For example:

Adding a third-party repository to winget.

In this example, we have added the official winget repository.

3. Update Repositories

Force an update to the existing repositories using the update subcommand. Run:

winget source update
Updating the existing repositories in winget.

The command updates the existing repositories with the latest package information.

4. Remove a Repository

Remove a repository from winget using the remove subcommand. The syntax is:

winget source remove --name [name]

For example:

Removing a repository from winget.

The specified repository is automatically removed.

5. Reset winget Sources

Use the reset --force subcommand to reset winget back to its original configuration, removing all third-party repositories and setting the sources to the default ones.

For example:

winget source reset --force
Resetting winget repositories back to the default state.

List Packages

See a list of all installed packages using the list option. Run:

winget list
Getting a list of installed apps using winget.

In the example above, the output includes the list of installed applications, including the application ID, version, and available updates.

Uninstall Packages

Uninstall an application using the uninstall option. The syntax is:

winget uninstall package_name

For example:

Uninstalling an app using winget.

Conclusion

This tutorial showed how to install and use the winget package manager on Windows. Use winget to automate package management, installation, and configuration, while keeping your apps up to date and system secure.

Was this article helpful?
YesNo
Bosko Marijan
Having worked as an educator and content writer, combined with his lifelong passion for all things high-tech, Bosko strives to simplify intricate concepts and make them user-friendly. That has led him to technical writing at PhoenixNAP, where he continues his mission of spreading knowledge.
Next you should read
APT vs APT-GET: What's the Difference?
June 25, 2020

Learn why the apt command was created and when to use it. This article also showcases how apt differs from the apt-get command.
Read more
Linux Commands Cheat Sheet
February 21, 2020

A list of all the important Linux commands in one place. Download our Linux Commands Cheat Sheet and save it for future reference.
Read more
How to Manage Python Packages On Windows
February 19, 2019

PIP for Python is a PyPI package manager. This tutorial shows how to install, upgrade, and configure PIP.
Read more
How to Install and Use Git on Windows
January 8, 2020

This tutorial shows how to install Git on Windows and a few basic commands to complete the initial setup.
Read more