Scoop使用手记

Scoop简介

Scoop是Windows的命令行安装程序,是一个强大的包管理工具。scoop会把软件下载、安装、配置等步骤全部帮你做完。

Scoop特性

Scoop是开源的,它从命令行安装你喜欢的程序,:

  • 消除权限弹出式窗口
  • 隐藏GUI向导式安装
  • 防止安装程序过多导致的路径污染
  • 避免安装卸载程序带来的不可预期的负面效应
  • 自动查找和安装依赖
  • 自动执行所有的配置

Scoop安装

环境要求

PowerShell terminal (version 5.1 +)

# 查看PowerShell版本
> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.22621.963
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.963
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

安装方法

# 启用远程脚本更改执行策略,选择" Y "
> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser 
# 下载安装(不能以管理员身份运行PS)
> irm get.scoop.sh | iex
# 查看是否安装成功
> 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在C:\Users\[user_name]\scoop目录。子目录中其他文件夹的含义如下:

  • apps——通过scoop安装的软件app都在里面,包括scoop自身。
  • buckets——管理软件的仓库,用于记录哪些软件可以安装、更新等信息,默认添加main仓库,可手动添加其他仓库或自建仓库。
  • cache——软件下载后安装包暂存目录。
  • persit——用于储存一些用户数据,不会随软件更新而替换。
  • shims——用于软链接应用,使应用之间不会互相干扰。

Scoop常用命令

Scoop常用命令如下:

#更新apps或者scoop自身:
>scoop update
#搜索app:
>scoop search xxx
#安装app:
>scoop install xxx
> scoop install git
# 指定版本安装:
>scoop install xxx@1.0
#卸载app:
>scoop uninstall xxx
# app列表
>scoop list
# 由于git依赖7zip,因此scoop自动下载并安装7zip,再安装git
Installed apps:
Name Version          Source Updated             Info
---- -------          ------ -------             ----
7zip 22.01            main   2023-06-06 10:49:04
git  2.41.0.windows.1 main   2023-06-06 10:49:30

不记得命令时,千万记得使用神器 scoop help

bucket软件仓库

Scoop使用bucket来存放软件包,默认的bucket叫做Main,官网给出了1000多个软件仓库的列表
在官网也可以搜索想安装的app,地址:https://scoop.sh/#/apps
另外,scoop-directory是一个可供搜索的bucket目录。
如vscode就在extras这个bucket中,因此安装vscode前需要先添加bucket,有点类似于linux的软件源.

PS C:\>scoop bucket add extras                                                 
Checking repo... OK                                                             
The extras bucket was added successfully.                                       
PS C:\> scoop install vscode                                                    
Installing 'vscode' (1.68.1) [64bit]  
...... 
# 指定url添加一个bucket
PS C:\> scoop bucket add raresoft 'https://github.com/L-Trump/scoop-raresoft.git'
Checking repo... OK
The raresoft bucket was added successfully.
PS C:\> scoop bucket add paxxs 'https://github.com/Paxxs/Cluttered-bucket.git'
Checking repo... OK
The paxxs bucket was added successfully.
# 列出当前bucket软件仓库的列表
PS C:\> scoop bucket list

Name     Source                                        Updated           Manifests
----     ------                                        -------           ---------
extras   https://github.com/ScoopInstaller/Extras      2023/6/6 8:34:14       1865
main     https://github.com/ScoopInstaller/Main.git    2023/6/6 8:33:50       1202
paxxs    https://github.com/Paxxs/Cluttered-bucket.git 2023/6/2 3:08:35         66
raresoft https://github.com/L-Trump/scoop-raresoft.git 2020/9/1 17:57:23        87

当然,也可以根据官网指南制作软件仓库中的软件,实质是生成一个json描述文件。

> scoop create https://example.com/foobar/1.2.3/foobar-package.zip
1) foobar
2) 1.2.3
3) foobar-package.zip
App name: 1
1) foobar
2) 1.2.3
3) foobar-package.zip
Version: 2
Created 'C:\Users\User\Desktop\foobar.json'.

国内scoop社区贡献

有些软件仓库容易过期或不再可用,经常更新的仓库应更容易受人青睐。 因此社区有大神做了自动从多个bucket仓库同步更新的仓库。下面是两个国内scoop代理镜像库。

Scoop-proxy-cn

适合中国大陆用户使用的 Scoop buckets 代理镜像库。从多个开源 bucket 仓库同步更新,并将从 github release 下载的应用地址修改为基于 ghporxy.com 的代理下载地址。
scoop-proxy-cn 仓库同步了 1.4w+ 应用。

> scoop bucket add spc https://ghproxy.com/https://github.com/lzwme/scoop-proxy-cn

# install apps
> scoop install spc/<app_name>
# 推荐安装并使用基于 go 语言开发的 scoop-search 工具替代。示例:
> scoop install scoop-search
# 使用 scoop-search
> scoop-search act

scoop-apps

仓库每天自动合并其他scoop仓库的更新

>scoop bucket add apps https://github.com/kkzzhizhou/scoop-apps

你有哪些喜欢的软件,欢迎评论区留言哦。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容