Scoop shim mechanism¶
The Scoop shim mechanism is a core component of the Scoop package manager for Windows, designed to facilitate command execution without relying on the system's global PATH variable^[scoop.md]. When Scoop installs a package, it typically places the application files in a versioned subdirectory within ~\scoop\apps\^[scoop.md]. To handle the inherent path changes that occur when an application is updated or its version changes, Scoop utilizes "shim" executables to provide a stable entry point for the user^[scoop.md].
Technical Implementation¶
During the installation process, Scoop creates a special directory known as the "Shims" directory, usually located at ~\scoop\shims^[scoop.md]. Instead of adding the specific binary directories of installed applications to the system PATH, Scoop adds this single Shims directory^[scoop.md].
A "shim" is a small executable file created within this directory that acts as a pointer or a proxy for the actual application binary^[scoop.md]. When a user types a command (e.g., java) in the terminal, the operating system locates the shim file via the PATH. Upon execution, the shim transparently redirects the call to the actual executable located in the application's specific version folder^[scoop.md].
Version Switching¶
The shim mechanism allows Scoop to manage multiple versions of a software package seamlessly. Because the shim acts as an intermediary, the underlying target path can be updated without requiring user intervention.^[scoop.md]
This is demonstrated by the scoop reset command, which is used to switch the active version of an application. When scoop reset is run, it updates the symbolic link (or the shim's target) to point to a different version directory.^[scoop.md] For example, switching from openjdk17 to openjdk11 updates the link so that the java command invokes the correct binary for the selected version^[scoop.md].
Sources¶
^[scoop.md]
Related Concepts¶
- Scoop
- [[Symbolic Links]]
- [[PATH Environment Variable]]