Introduction:#
scoop is a package management tool for Windows environments. For developers, a package management tool is an essential tool. Without a package management tool, we would need to download the required environments from official websites and configure the environment variables ourselves, which is very cumbersome. With a package management tool, we only need to configure the environment variables for the package management tool and install the packages we need through the package management tool. The package management tool will automatically configure the corresponding environment variables for us.
1. Installing SCOOP#
Installing scoop is very simple and only requires two commands:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
irm get.scoop.sh | iex
The first line of code is optional and is only needed if you are running a remote script for the first time.
By default, scoop is installed in the C drive. If you want to install it in a different drive, you need to execute the following four commands (or manually add them to the environment variables):
$env:SCOOP='E:\UserScoop' # Change it to the location where you want to install
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User') # User environment variable
$env:SCOOP_GLOBAL='E:\GlobalScoopApps' # Change it to the location where you want to install
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine') # System environment variable
Open Windows PowerShell (version 5.1 or above), enter the above commands, and enter A to change the policy.
Enter the second command to install scoop. Since I have already installed it, the following prompt is displayed:
2. Testing scoop#
If you enter "scoop" in PowerShell and see the following prompt, it means the installation was successful:
3. Adding buckets to scoop#
The concept of buckets in scoop is similar to software sources. Only by adding a "software source" can we install the packages we want. Scoop itself has the "main" source, but it has too few packages, and many of the environments we need for development are not included.
Execute the following command to add a bucket:
scoop bucket add <bucket>
You can find buckets on the scoop official website here.
Only the part after "/" is needed for the bucket.
For example, let's add the Java bucket:
scoop bucket add java
After adding the bucket, we can install JDK. Here, we can use the search command to find out which versions of JDK are available:
scoop search jdk
We can see that scoop has a wide range of JDK versions, including the newer graalvm22-jdk17. Let's try installing it:
scoop install graalvm22-jdk17
You may be familiar with aria2 in the image above. Scoop can use aria2 for package downloads, which speeds up the download process with multi-threading.
We just need to install aria2 through scoop, and scoop will automatically use aria2 for package downloads.
scoop install aria2
Aria2 will take effect the next time you use scoop to install packages.