Managing packages on Windows with Scoop

illustrations illustrations illustrations illustrations illustrations illustrations illustrations
post-thumb

Published on 12 May 2022 by Andrew Owen (3 minutes)

If you have even a passing familiarity with Linux, you’re probably aware of the concept of package management. The goal is to simplify the installing, upgrading, configuring and removing software. One of the key features is dependency management: if your software depends on some other software that isn’t already installed, the package manager will give you the option to install it.

Microsoft provides a Windows Package Manager, known as winget. However, at the time of writing it’s only been around for a couple of years and I got a hash error when I tried to use it to install Google Chrome.

A popular third-party option is Chocolatey, but it depends on NuGet which is a package manager in its own right. I prefer to use Scoop. The latest install instructions are on the website, but I’ll go through how I installed it on Windows 11.

  1. Open PowerShell.
  2. [Optional] Enter Set-ExecutionPolicy RemoteSigned -Scope CurrentUser. This enables a remote script to run the first time.
  3. Enter Invoke-WebRequest get.scoop.sh | Invoke-Expression. This installs Scoop.
  4. Enter scoop bucket add extras. The extras bucket includes software that doesn’t match the main criteria for inclusion.
  5. Enter scoop bucket add nonportable. The nonportable bucket includes software that must be installed to a specific location.
  6. Enter scoop install git. Even if you’re not using Git, Scoop uses it to perform updates.
  7. Enter scoop update. This will update the buckets you added.

Now you’re ready to add whatever packages you like. Here are some examples:

  • Docker: scoop install docker
  • GitHub Desktop: scoop install github
  • Google Chrome: scoop install googlechrome
  • Helm: scoop install helm
  • Notepad++: scoop install notepadplusplus
  • SQL Server Management Studio: scoop install sql-server-management-studio-np
  • Visual Studio Code: scoop install vscode

You can verify the software has been correctly installed by viewing the C:\Users\<user>\scoop\apps folder.

To update all your installed packages to the latest version, enter scoop update all. When I was creating a VM for developer training with numerous prerequisite software packages, I found it useful to put this command in a startup script.

Having recently revisited the VM setup for Azure Labs, I’ve discovered a few gotchas. Here’s how I got it working.

  1. Create an Azure Labs template VM from the Windows 10 N Enterprise with Visual Studio 2019 Community image in the marketplace.
  2. Start the VM, then from the standard shell enter: runas /trustlevel:0x20000 powershell.exe. The Scoop install script won’t run with admin privileges. The ExecutionPolicy directive doesn’t work when the shell is run as administrator. And the VM template doesn’t give you the option to start a shell without admin privileges.
  3. From PoweShell, enter: iwr get.scoop.sh -useb | iex. The -useb directive is required with Windows N (something to do with Internet Explorer).
  4. Close both shells and then open PoweShell and enter scoop bucket add main.
  5. Enter scoop update.

You can now carry on as normal. You don’t need to install Git, because it’s included with the VS 2019 Community image.

Image: Original by Ian Dooley.