一款优雅的Windows包管理器Scoop

前言

Scoop 作为一款较为流行的 Windows 包管理器,用它来下载软件、管理版本十分方便。

什么是 Scoop

Scoop 是一款适用于 Windows 平台的命令行软件(包)管理工具,这里是Scoop 官网。简单来说,就是可以通过命令行工具(PowerShell、CMD 等)实现软件(包)的安装管理等需求,通过简单的一行代码实现软件的下载、安装、卸载、更新等操作。其灵感来源于 macOS 的Homebrew

当然如果用过 Linux 系统,使用 apt-get 工具安装过软件,或者用过 Python,知道 pip 工具用于管理 Python 各种依赖包,那么理解 Scoop 就比较容易,这些工具的设计理念与使用方法都非常类似。

Scoop 从 bucket 下载的软件是绿色安全的,不会附带广告之类的扰人组件,同时它也让安装变得很简单。Scoop 凭借 shims(垫片机制)使得在 windows 下管理环境变量十分简单,用户只需执行简单的 CLI 命令来安装程序,Scoop 会默认添加环境变量,从而使得整个过程十分顺滑。

安装 Scoop

> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

> irm get.scoop.sh -outfile 'install.ps1'

> .\install.ps1 -ScoopDir 'D:\Scoop' -ScoopGlobalDir 'F:\GlobalScoopApps' -NoProxy

使用 Scoop

scoop help

scoop 基本语法命令:

> scoop help
Usage: scoop <command> [<args>]

Available commands are listed below.

Type 'scoop help <command>' to get more help for a specific command.

Command    Summary

-------    -------

alias      Manage scoop aliases
bucket     Manage Scoop buckets
cache      Show or clear the download cache
cat        Show content of specified manifest.
checkup    Check for potential problems
cleanup    Cleanup apps by removing old versions
config     Get or set configuration values
create     Create a custom app manifest
depends    List dependencies for an app, in the order they'll be installed
download   Download apps in the cache folder and verify hashes
export     Exports installed apps, buckets (and optionally configs) in JSON format
help       Show help for a command
hold       Hold an app to disable updates
home       Opens the app homepage
import     Imports apps, buckets and configs from a Scoopfile in JSON format
info       Display information about an app
install    Install apps
list       List installed apps
prefix     Returns the path to the specified app
reset      Reset an app to resolve conflicts
search     Search available apps
shim       Manipulate Scoop shims
status     Show status and check for new app versions
unhold     Unhold an app to enable updates
uninstall  Uninstall an app
update     Update apps, or Scoop itself
virustotal Look for app's hash or url on virustotal.com
which      Locate a shim/executable (similar to 'which' on Linux)
scoop bucket

scoop 桶命令,用来管理添加、删除已有桶。

> scoop bucket --help
Usage: scoop bucket add|list|known|rm [<args>]

Add, list or remove buckets.

Buckets are repositories of apps available to install. Scoop comes with
a default bucket, but you can also add buckets that you or others have
published.

To add a bucket:
    scoop bucket add <name> [<repo>]

e.g.:
    scoop bucket add extras https://github.com/ScoopInstaller/Extras.git

Since the 'extras' bucket is known to Scoop, this can be shortened to:
    scoop bucket add extras

To list all known buckets, use:
    scoop bucket known
scoop search

scoop 用来搜索软件的命令,可以选择 scoop-search 替代。

> scoop search dotnet-sdk-lts
Results from local buckets...

Name           Version Source   Binaries
----           ------- ------   --------
dotnet-sdk-lts 8.0.412 versions

> scoop-search dotnet-sdk-lts
'versions' bucket:
    dotnet-sdk-lts (8.0.412)
scoop instal、scoop uninstall

安装软件与卸载软件

> scoop install --help
Usage: scoop install <app> [options]

e.g. The usual way to install an app (uses your local 'buckets'):
     scoop install git

To install a different version of the app
(note that this will auto-generate the manifest using current version):
     scoop install gh@2.7.0

To install an app from a manifest at a URL:
     scoop install https://raw.githubusercontent.com/ScoopInstaller/Main/master/bucket/runat.json

To install a different version of the app from a URL:
      scoop install https://raw.githubusercontent.com/ScoopInstaller/Main/master/bucket/neovim.json@0.9.0

To install an app from a manifest on your computer
     scoop install \path\to\app.json

To install an app from a manifest on your computer
     scoop install \path\to\app.json@version

Options:
  -g, --global                    Install the app globally
  -i, --independent               Don't install dependencies automatically
  -k, --no-cache                  Don't use the download cache
  -s, --skip-hash-check           Skip hash validation (use with caution!)
  -u, --no-update-scoop           Don't update Scoop before installing if it's outdated
  -a, --arch <32bit|64bit|arm64>  Use the specified architecture, if the app supports it

> scoop uninstall --help
Usage: scoop uninstall <app> [options]

e.g. scoop uninstall git

Options:
  -g, --global   Uninstall a globally installed app
  -p, --purge    Remove all persistent data
scoop home

获取软件主页

> scoop home --help
Usage: scoop home <app>
scoop info

获取软件信息

> scoop info git
Name        : git
Description : Distributed version control system
Version     : 2.50.1
Bucket      : main
Website     : https://gitforwindows.org
License     : GPL-2.0-only
Updated at  : 2025/7/9 4:29:40
Updated by  : github-actions[bot]
Installed   : 2.50.1
Binaries    : bin\sh.exe | bin\bash.exe | cmd\git.exe | cmd\gitk.exe | cmd\git-gui.exe | cmd\scalar.exe | usr\bin\tig.e
              xe | git-bash.exe
Shortcuts   : Git Bash | Git GUI
Environment : GIT_INSTALL_ROOT = <root>
Notes       : Set Git Credential Manager Core by running: "git config --global credential.helper manager"

              To add context menu entries, run '<root>\install-context.reg'

              To create file-associations for .git* and .sh files, run '<root>\install-file-associations.reg'
scoop update、scoop status

更新软件、获取软件更新状态

> scoop update --help
Usage: scoop update <app> [options]

'scoop update' updates Scoop to the latest version.
'scoop update <app>' installs a new version of that app, if there is one.

You can use '*' in place of <app> to update all apps.

Options:
  -f, --force            Force update even when there isn't a newer version
  -g, --global           Update a globally installed app
  -i, --independent      Don't install dependencies automatically
  -k, --no-cache         Don't use the download cache
  -s, --skip-hash-check  Skip hash validation (use with caution!)
  -q, --quiet            Hide extraneous messages
  -a, --all              Update all apps (alternative to '*')

> scoop status --help
Usage: scoop status

Options:
  -l, --local         Checks the status for only the locally installed apps,
                      and disables remote fetching/checking for Scoop and buckets