上一篇里介绍了winget包管理器的使用,这一篇里咱们说一下scoop包管理器.
这个包管理器出现的很早,也很成熟了,用起来更接近Linux终端的体验.我是作为winget的补充来使用的.
主要用来管理我的开发环境.
项目链接
Scoop is a command-line installer for Windows.
Scoop 是一款Windows下的命令行软件管理工具.
Scoop installs programs from the command line with a minimal amount of friction. It:
Scoop is very scriptable, so you can run repeatable setups to get your environment just the way you like, e.g.:
scoop install sudo
sudo scoop install 7zip git openssh --global
scoop install aria2 curl grep sed less touch
scoop install python ruby go perl
简单来说,他比winget更强大(只是不够本土化,winget的软件本土化做的要更好一些,但对我来说在环境管理方面,scoop也有不可替代性)
.
打开Windows Terminal
后输入
iwr -useb get.scoop.sh | iex
即可完成安装
PS C:\Users\13538> iwr -useb get.scoop.sh | iex
Initializing...
Downloading...
Extracting...
Creating shim...
Adding ~\scoop\shims to your path.
Scoop was installed successfully!
Type 'scoop help' for instructions.
我在安装的时候报错了
PS C:\Users\13538> iwr -useb get.scoop.sh | iex
Initializing...
PowerShell requires an execution policy in [Unrestricted, RemoteSigned, ByPass] to run Scoop. For example, to set the execution policy to 'RemoteSigned' please run 'Set-ExecutionPolicy RemoteSigned -Scope CurrentUser'.
Abort.
只需要按照提示执行一下
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
之后再重新执行安装程序即可
$env:SCOOP='D:\Scoop Data'
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')
$env:SCOOP_GLOBAL='D:\Scoop Data'
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine')
查找指定软件scoop search 软件名
PS C:\Users\13538> scoop search neofetch
Results from local buckets...
Name Version Source Binaries
---- ------- ------ --------
neofetch 7.1.0 main
搜索全部软件scoop search
会直接展示所有软件
PS C:\Users\13538> scoop search
Results from local buckets...
Name Version Source Binaries
---- ------- ------ --------
1password-cli 2.7.1 main
7zip 22.01 main
7zip19.00-helper 19.00 main
abc 1.0.0 main
ack 3.6.0 main
.......(省略)
zoxide 0.8.3 main
zstd 1.5.2 main
命令格式为scoop install 软件名
PS C:\Users\13538> scoop install neofetch
WARN Purging previous failed installation of neofetch.
ERROR 'neofetch' isn't installed correctly.
Removing older version (7.1.0).
'neofetch' was uninstalled.
Installing 'neofetch' (7.1.0) [64bit] from main bucket
neofetch (333.6 KB) [=========================================================================================] 100%
Checking hash of neofetch ... ok.
Linking ~\scoop\apps\neofetch\current => ~\scoop\apps\neofetch\7.1.0
Creating shim for 'neofetch'.
'neofetch' (7.1.0) was installed successfully!
命令格式为scoop uninstall 软件名
PS C:\Users\13538> scoop uninstall aria2
Uninstalling 'aria2' (1.36.0-1).
Removing shim 'aria2c.shim'.
Removing shim 'aria2c.exe'.
Unlinking ~\scoop\apps\aria2\current
'aria2' was uninstalled.
查看可更新软件scoop update
PS C:\Users\13538> scoop update
Updating Scoop...
Updating 'main' bucket...
Scoop was updated successfully!
更新指定软件scoop update 软件名
PS C:\Users\13538> scoop update neofetch
neofetch: 7.1.0 (latest version)
Latest versions for all apps are installed! For more information try 'scoop status'
更新全部软件scoop update *
PS C:\Users\13538> scoop update *
Latest versions for all apps are installed! For more information try 'scoop status'
即可升级所有软件
查看软件状态是否为最新
PS C:\Users\13538> scoop status
Scoop is up to date.
Everything is ok!
检查scoop自身我的还真查出问题来了 有问题按提示操作就好
PS C:\Users\13538> scoop checkup
WARN LongPaths support is not enabled.
You can enable it by running:
sudo Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
(Requires 'sudo' command. Run 'scoop install sudo' if you don't have it.)
ERROR 'Inno Setup Unpacker' is not installed! It's required for unpacking InnoSetup files. Please run 'scoop install innounp'.
ERROR 'dark' is not installed! It's required for unpacking installers created with the WiX Toolset. Please run 'scoop install dark' or 'scoop install wixtoolset'.
WARN Found 3 potential problems.
......(按提示操作)
PS C:\Users\13538> scoop checkup
No problems identified!
每当scoop下载了软件之后,软件包文件会被默认缓存下来,即使卸载了软件,缓存也不会被删除,想要清理缓存,可以使用scoop cache rm 软件名
PS C:\Users\13538> scoop cache rm sudo
Removing https_raw.githubusercontent.com_lukesampson_psutils_c7116ac143ca81f223e6091d0974f45ac241eb1d_sudo.ps1...
Deleted: 1 file, 2.2 KB
想要清除所有缓存,可以使用scoop cache rm *
PS C:\Users\13538> scoop cache rm *
Removing https_7-zip.org_a_7z2201-x64.msi...
Removing https_github.com_aria2_aria2_releases_download_release-1.36.0_aria2-1.36.0-win-64bit-build1.zip...
Removing https_raw.githubusercontent.com_ScoopInstaller_Binary_master_dark_dark-3.11.2.zip...
Removing https_github.com_git-for-windows_git_releases_download_v2.38.0.windows.1_PortableGit-2.38.0-64-bit.7z.exe_dl.7z...
Removing https_raw.githubusercontent.com_ScoopInstaller_Binary_master_innounp_innounp050.rar...
Removing https_raw.githubusercontent.com_dylanaraps_neofetch_7.1.0_neofetch...
软件升级后,其旧版本仍会被保留下来可以使用scoop cleanup 软件名
清理指定软件的旧版本
PS C:\Users\13538> scoop cleanup sudo
sudo is already clean
scoop cleanup *
可以清理全部软件的旧版本
PS C:\Users\13538> scoop cleanup *
Everything is shiny now!
scoop home 软件名
可以查看指定软件的主页,会自动使用默认浏览器直接打开
多个版本的软件共存时,可以通过scoop reset 想要使用的版本名称
进行切换,比如jdk8和jdk11
scoop中的仓库被叫做bucket,安装好的scoop默认会带有一个主仓库,名字就叫Scoop,主仓库里面的软件,有很多,但是基本都是比较适合程序员的软件,更重要的一点是,要入选主仓库的软件,都是没有GUI的,也就是说都是命令行软件,而scoop官方还有一个第三方bucket,里面有更多的常用软件,所以我们要添加额外的仓库
想要查看可添加仓库
PS C:\Users\13538> scoop bucket known
main
extras
versions
nirsoft
php
nerd-fonts
nonportable
java
games
也可以添加不在上述列表的非官方仓库,命令格式为scoop bucket add 仓库名 仓库的github地址
第三方仓库搜索
PS C:\Users\13538> scoop bucket add DEV-tools "https://github.com/anderlli0053/DEV-tools"
Checking repo... OK
The DEV-tools bucket was added successfully.
PS C:\Users\13538> scoop bucket list
Name Source Updated Manifests
---- ------ ------- ---------
extras https://github.com/ScoopInstaller/Extras 2022/10/7 8:47:10 1692
main https://github.com/ScoopInstaller/Main 2022/10/7 8:47:15 1095
命令格式为scoop bucket rm 仓库名
PS C:\Users\13538> scoop bucket rm extras