Scoop

Scoop

Introduction

Scoop is an installer
The goal of Scoop is to let you use Unix-y programs in a normal Windows environment
Mike Zick

Scoop是一个 Windows 的下载工具,可以方便的安装各种软件。

Directory Structure

1
2
3
4
5
6
7
8
        Directory: D:\envir_vars\scoop
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d----          6/1/2024   3:13 PM                󰀻  apps
d----          6/1/2024   2:48 PM                  buckets
d----          6/1/2024   3:13 PM                  cache
d----          6/1/2024   2:49 PM                  persist
d----          6/1/2024   3:13 PM                  shims
  • Apps: 安装的各个软件或程序
  • Buckets: 存放各种 app 的集合,buckets 目录下存放许多个 bucket,例如 main 为默认的 bucket,extras 包括部分未收录 main bucket 的常用软件,nerdfonts 为存放字体 app 的 bucket,每一个 bucket 都是一个 github 仓库,仓库里维护许多 app 的 json 文件,json 文件里存放了 app 的安装信息,包括 app 的版本,LICENSE,下载地址 url etc,这些 json 文件被称作 App manifest,下面是一个简单的示例
    1
    2
    3
    4
    5
    6
    {
      "version": "1.0",
      "url": "https://github.com/lukesampson/cowsay-psh/archive/master.zip",
      "extract_dir": "cowsay-psh-master",
      "bin": "cowsay.ps1"
    }
  • Cache: 存放下载的临时文件
  • Shims: scoop 在 environment variable 中添加了该目录;通过 scoop 安装的程序,scoop 会自动为其在 Shims 目录下生成一个对应的 exe 文件,这样程序安装后可以直接在命令行中调用。对于 GUI 程序,scoop 会自动在开始菜单中添加其快捷方式,目录C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps

Installation

Default Installation

在终端中使用 Powershell 执行以下命令即可安装 Scoop。默认把 scoop 安装到 C:\Users\<YOUR USERNAME>\scoop 目录下

1
2
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression

Advance Installation。

如果希望把 scoop 安装到其它目录,可以执行以下命令。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$ irm get.scoop.sh -outfile 'install.ps1'

$ ls | grep ps1
-a---          6/1/2024   2:24 PM          25628 󰞷  install.ps1

$ .\install.ps1 -?

NAME
    D:\envir_vars\install.ps1

SYNOPSIS
    Scoop installer.


SYNTAX
    D:\envir_vars\install.ps1 [[-ScoopDir] <String>] [[-ScoopGlobalDir] <String>] [[-ScoopCacheDir] <String>] [-NoProxy] [[-Proxy] <Uri>]
    [[-ProxyCredential] <PSCredential>] [-ProxyUseDefaultCredentials] [-RunAsAdmin] [<CommonParameters>]


DESCRIPTION
    The installer of Scoop. For details please check the website and wiki.


RELATED LINKS
    https://scoop.sh
    https://github.com/ScoopInstaller/Scoop/wiki

REMARKS
    To see the examples, type: "Get-Help D:\envir_vars\install.ps1 -Examples"
    For more information, type: "Get-Help D:\envir_vars\install.ps1 -Detailed"
    For technical information, type: "Get-Help D:\envir_vars\install.ps1 -Full"
    For online help, type: "Get-Help D:\envir_vars\install.ps1 -Online"

$  .\install.ps1 -ScoopDir 'D:\envir_vars\scoop\' -ScoopGlobalDir 'D:\envir_vars\scoop\GlobalApps' -NoProxy
Initializing...
Downloading...
Creating shim...
Adding D:\envir_vars\scoop\\shims to your path.
Scoop was installed successfully!
Type 'scoop help' for instructions.

如果你已经安装了 Scoop,想要把 scoop 安装到其它目录,可参考Change Directory
迁移应用也可以通过scoop export导出 json 然后再通过 import 导入下载,若直接移动源目录下的文件,shims 实际上是无效的,它指向的位置仍然是原先目录

Command

Install & Update & Uninstall

  • scoop search vim 查找 app
  • scoop install neovim 安装指定 app
  • scoop install [email protected] 安装指定版本 app
  • scoop install -g git 安装全局 app
    Install Options:
    -g, –global Install the app globally
    -i, –independent Don’t install dependencies automatically
    -k, –no-cache Don’t use the download cache
    -u, –no-update-scoop Don’t update Scoop before installing if it’s outdated
    -s, –skip Skip hash validation (use with caution!)
    -a, –arch <32bit|64bit> Use the specified architecture, if the app supports it

  • scoop list List installed apps
  • scoop status Show status and check for new app versions
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Name      Installed Version Latest Version Missing Dependencies Info
    ----      ----------------- -------------- -------------------- ----
    7zip      23.01             24.05
    aria2     1.36.0-1          1.37.0-1
    eza       0.18.15           0.18.16
    fastfetch 2.11.3            2.14.0
    fd        9.0.0             10.1.0
    git       2.42.0.2          2.45.1
    gitui     0.26.1            0.26.2
    kotlin    1.9.22            2.0.0
    neovim    0.9.5             0.10.0
  • scoop update update scoop
  • scoop update neovim 7zip aria2 更新指定软件
  • scoop update * 更新所有软件

  • scoop uninstall neovim 卸载指定软件
  • scoop uninstall -p python 卸载软件及其配置文件
  • scoop uninstall -g git 卸载全局软件

Clean

  • scoop cleanup git 清理指定软件
  • scoop cleanup * 清理所有软件
  • scoop cache rm * 清理缓存

MISC

在同一程序的不同版本之间切换

1
2
3
scoop reset python@3.10.6
# do something
scoop reset python@3.12.3
  • 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
  • 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
  • unhold Unhold an app to enable updates
  • home Opens the app homepage
  • import Imports apps, buckets and configs from a Scoopfile in JSON format
  • info Display information about an app
  • prefix Returns the path to the specified app
  • shim Manipulate Scoop shims
  • virustotal Look for app’s hash or url on virustotal.com
  • which Locate a shim/executable (similar to ‘which’ on Linux)

Ref

Scoop_Wiki

作者

Jiaxing Gao

发布于

2024-06-01

更新于

2024-11-23

许可协议

评论

}