Setting Up Scoop as a Windows Package Manager

MacOS has Homebrew. Linux has APT. Windows sort of has OneGet. I dual-boot Linux on my desktop, but unfortunately that doesn't seem too feasible on my Surface Book. Since there's a whole bunch of software that is difficult to keep up to date (think 7-Zip), I wanted to have something similar to a package manager that I can use to easily keep everything up to date. I started looking around and eventually found Scoop. First though, what about Chocolatey?

Chocolatey is Messy

Chocolatey has a pretty simple tagline:

The sane way to manage software on Windows

Chocolatey is scriptable, has a ton of packages in the Community Repository, and works well with PowerShell. It's by far and away the best supported of the different package manager options. You can set up almost every single piece of software you might need on a new computer and get going. There are some issues for my particular use case:

  • Versioning: Chocolatey lets you install any version of any package and uses Nuget to figure it all out. This is great, but I don't want to have to remember which version of something I've installed.
  • Admin Rights: The open source version of Chocolatey can handle local installs, but it does not necessarily do so easily without getting the paid version and does not guarantee security.
  • Can pollute your path variable if too many things add themselves to it.
  • It can be difficult to tell which app is the correct one to install. This is made somewhat better by the moderators and the verification process, but this is still an issue (install 7-Zip, 7-Zip (Install), or 7-Zip (Portable)).

Scooping up the Mess

For most users, Scoop is probably a worse tool. It's focused primarily on developer tools, and doesn't have much in the way of software unless there's a portable version. You can't install software like QGIS and have it managed for you. There are some upsides though:

  • No Admin Rights - Everything is installed on your local account. Since I can't count
  • No worrying about dependencies - At the tradeoff of space, every package is installed with its own dependencies.
  • No worrying about versions - Only the most up to date version is available, except for Python 2.7 and Ruby 1.9.
  • App repo is literally a git repo of json files with installation instructions.
  • Uses shims instead of polluting the path. Admittedly this can produce its own issues.

These are mostly summed up on Scoop's own Github page. The fact Scoop has it's own Wiki page dedicated to a Chocolatey comparison tells you that Chocolatey is the dominant player in the market.

Setting up Scoop

Like most of the Windows package managers, setting up Scoop is as simple as writing a PowerShell script. It starts off with installing Scoop, adding some basic tools, some more advanced tools, and then some software. You can also install programming languages with Scoop, but I use the Anaconda distribution of Python which isn't available.

Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

scoop install 7zip curl git openssh cmder
[environment]::setenvironmentvariable('GIT_SSH', (resolve-path (scoop which ssh)), 'USER')

scoop install latex r

scoop bucket add extras

scoop install gvim rstudio vscode sqlitebrowser

scoop install sumatrapdf keepassxc inkscape

It was pretty easy to install everything and when you decide to uninstall some software package after not using it for awhile, it won't leave your computer cluttered and messy. Even better, a quick script like this is the perfect thing for a Github Gist so you don't even have to plug in a flash drive. To update Scoop (think apt update), just use the commands below.

scoop update        # apt update
scoop update latex  # apt install --only-upgrade latex
scoop update *      # apt upgrade

It Can't Scoop Up Everything

Since Scoop only supports one version of every piece of software and it assumes you are always linking to the most recent version, I ran into some troubles with the json file in the app bucket not being completely up to date. I could not install latex or gvim because of version issues, and KeePassXC did not create a shim properly. On the plus side, using json means it was super easy to update them myself until they are updated on Github. Let's look at LaTeX as an example. Normally, the command would just be:

scoop install latex

This should just automatically install MikTex portable. Instead, I got an error. Naturally it was updated 5 or 6 hours later, but let's take a look at the json file structure anyway.

{
    "homepage": "https://miktex.org",
    "version": "2.9.6361",
    "license": "https://miktex.org/copying",
    "url": "http://mirrors.ctan.org/systems/win32/miktex/setup/miktex-portable-2.9.6361.exe#/dl.7z",
    "hash": "745a6fa16593cda188bda10dc0915d2343301b5b0e5ca5a4800cf02385ae48b3",
    "env_add_path": "texmfs\\install\\miktex\\bin",
    "checkver": {
        "url": "https://miktex.org/portable",
        "re": "miktex-portable-([\\d.]+).exe"
    },
    "autoupdate": {
        "url": "http://mirrors.ctan.org/systems/win32/miktex/setup/miktex-portable-$version.exe#/dl.7z"
    }
}

Finding the latest version and the appropriate url is pretty easy. To find the hash, use Get-FileHash in PowerShell. The default hash for Scoop is SHA256. If you to download the .exe from MikTex's website, then you can find the hash using the code below.

PS C:\path\> Get-FileHash .\miktex-portable-2.9.6361.exe | Format-List


Algorithm : SHA256
Hash      : 745A6FA16593CDA188BDA10DC0915D2343301B5B0E5CA5A4800CF02385AE48B3
Path      : C:\Users\prebe\Downloads\miktex-portable-2.9.6361.exe

It's best to keep a previous version around though, since it'll ask you to either commit or stash your changes next time you try to update.

Conclusions

Like most tools, I was a little frustrated at first. I second guessed myself a lot wondering whether I should have just gone with the more popular Chocolatey which doesn't seem like it would have these issues. At the same time, Scoop's incredibly simple setup meant it was really easy to jump in and fix the problems myself. Chocolatey might still be a better option out of the box for you, but I think Scoop is a great choice, particularly for someone like me who doesn't have admin rights on their work machines.

Icons in cover photo made by Madebyoliver from www.flaticon.com is licensed by CC 3.0 BY