[折腾]scoop
windows下好用的包管理器scoop
一、scoop简介
Scoop是Windows的命令行安装程序,是一个强大的包管理工具。可以在github上找到其项目的相关信息,项目网址。
安装的起因:在学习中如果要安装像gcc、git等一些需要手动配置相关参数的工具,需要先去官网下载安装程序,点击安装,之后还需要配置环境变量,不仅过程麻烦。而且工具多了之后整理起来也相当不容易,配置也很杂,整个电脑就像被污染了一样。不仅如此,在windows下配置一个能使用的GCC编译器和GDB调试器,能够不出各种奇奇怪怪的问题就已经是谢天谢地了。这时候就好羡慕隔壁的linux强大的apt包管理器,或者mac的homebrew。这时候scoop横空出世。安装scoop后,只需要在命令行输入简单的一串命令即可安装你想要的软件。比如我想安装gcc,只需要输入
1 | |
就能够帮我完成从安装到环境变量全部过程。从此告别百度为什么gcc命令出错。
二、安装scoop
1、要求
- Windows 7 SP1 + / Windows Server 2008+
- Powershell 5 或者更高版本和.NET Framework 4.5或者更高版本
- 必须启用PowerShell,例如Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
- 你能够正常(最好是快速)访问全球最大同性交友网站
2、安装
首先打开使用管理员身份打开PowerShell,在里面输入这条命令启用脚本:
1
set-executionpolicy remotesigned -scope currentuser1
2
3iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
或者
iwr -useb get.scoop.sh | iexscoop命令。
1
scoop -h
如果出现了 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
37PS D:\hexo> scoop -h
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 will 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默认安装位置。
3、更改默认安装位置
将scoop安装到自定义目录。需要在执行scoop的安装脚本之前执行。
1
2$env:SCOOP='D:\Applications\Scoop' \\你的目录
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')scoop安装软件的位置更改。 1
2$env:SCOOP_GLOBAL='F:\GlobalScoopApps' \\ 指定目录
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine')
三、使用方法
| 命令 | 作用 |
|---|---|
| search | 搜索软件 |
| install | 安装软件 |
| update | 更新软件和更新软件源 |
| status | 查看软件状态,是否有更新 |
| uninstall | 卸载软件 |
| info | 查看软件信息 |
| home | 查看软件主页 |
| list | 查看已安装的软件 |
| cache | 查看安装、更新时的缓存 |
| virustotal | 在virustotal.org上查看软件的哈希值 |
四、额外安排
1、使用国内源
1 | |
2、添加其他软件库
scoop自带软件库不包含大部分软件,所以需要添加其他软件库。
1
2
3scoop bucket add extras
# 如上添加的是官方维护的 extras 软件库
scoop update
五、为什么要强推包管理器
作为一个包管理器,最基础,也是最重要的功能就是安装软件。正在使用 Windows 的你一定在想:「为什么我要用它?为什么我不直接百度一下?」 当然可以。 1. 百度一下这个软件 2. 然后在一堆奇奇怪怪的下载链接中徘徊 3. 看到一个看上去最无毒,最没有捆绑的安装包 4. 小心翼翼的避开流氓特性 5. 选择一个合适的安装位置,防止到处拉屎
好麻烦的安装!!!
Scoop 等一系列包管理器的诞生,第一大便利就是省去了上述繁琐的「搜索 - 下载 - 安装」的步骤,让我们能够通过「一行代码」急速安装。💪
同时,用Scoop来安装和管理我们的软件: *
集搜索、下载、安装、更新于一体;极大的降低了安装维护一个软件的成本,我们甚至不需要在软件复杂的菜单中找到更新按钮,也不会有烦人的弹窗提醒你更新。
* 将软件干干净净的安装到电脑的{用户文件夹}下:污染路径。 *
卸载软件也能够清空软件任何数据。 *
有一些必要但是安装不容易的软件例如gdb也能够一键解决。