# rubymetric/chsrc

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/rubymetric-chsrc).**

6,775 stars · 275 forks · C · GPL-3.0

## Links

- GitHub: https://github.com/RubyMetric/chsrc
- Homepage: https://chsrc.run/
- awesome-repositories: https://awesome-repositories.com/repository/rubymetric-chsrc.md

## Topics

`archlinux` `brew` `c11` `cargo` `composer` `cpan` `debian` `fedora` `flathub` `gem` `guix` `linux` `macos` `maven` `nix` `npm` `pip` `raku` `ubuntu` `windows`

## Description

chsrc is a cross-platform command-line tool that changes package manager and software repository URLs to faster or local mirrors across Linux, macOS, Windows, and BSD. It functions as a source mirror framework, embedding a database of mirror URLs and metadata directly into its binary at build time, eliminating the need for plugins or runtime downloads.

The tool distinguishes itself through idempotent configuration patching, rewriting repository configuration files deterministically so repeated runs produce the same result and restoration is always possible. It includes a latency probe that measures TCP connection time to available mirrors and automatically selects the fastest one without user intervention, and supports scoped source changes at the project, user, or system level depending on the target's configuration capabilities.

chsrc provides a unified interface for switching software sources, listing supported targets and mirrors, restoring default upstream URLs, and applying specific mirrors from a list or custom URL. Its architecture abstracts every package manager's config format behind a single command-line interface and a common source-switching API, using platform-agnostic shell commands and file writes to modify system configuration files across operating systems.

## Tags

### Development Tools & Productivity

- [Source Changers](https://awesome-repositories.com/f/development-tools-productivity/cross-platform-package-managers/source-changers.md) — Changes package manager and software repository URLs to faster mirrors across Linux, macOS, Windows, and BSD.
- [Source Switchers](https://awesome-repositories.com/f/development-tools-productivity/software-package-repositories/source-switchers.md) — Switches package manager and software repository URLs to faster or local mirrors across multiple operating systems. ([source](https://chsrc.run/))
- [Embedded Mirror Databases](https://awesome-repositories.com/f/development-tools-productivity/build-tooling/build-orchestration-logic/build-orchestration-configuration/build-automation-systems/build-systems/binary-compilation-toolchains/server-binary-compilers/hardware-specific-binaries/os-binary-compilation/display-mirroring-binaries/embedded-mirror-databases.md) — Embeds a database of mirror URLs and metadata directly into the binary at build time.
- [Platform-Agnostic Config Patchers](https://awesome-repositories.com/f/development-tools-productivity/cross-platform-distribution-strategies/platform-agnostic-config-patchers.md) — Uses platform-agnostic shell commands and file writes to modify system configuration files across operating systems.
- [Source Mirror Frameworks](https://awesome-repositories.com/f/development-tools-productivity/package-sources/mirror-source-redirection/source-mirror-frameworks.md) — Provides a framework for changing software sources that supports multiple package managers, operating systems, and mirror providers.
- [Mirror Source Restorations](https://awesome-repositories.com/f/development-tools-productivity/repository-state-restoration/mirror-source-restorations.md) — Restores original upstream repository URLs after mirror changes, undoing previous source modifications.
- [Mirror Source Redirection](https://awesome-repositories.com/f/development-tools-productivity/package-sources/mirror-source-redirection.md) — Automatically selects the fastest mirror by measuring latency to available sources for a given target.
- [Source Restorers](https://awesome-repositories.com/f/development-tools-productivity/package-sources/mirror-source-redirection/source-restorers.md) — Restores the original upstream repository URLs for a given target, undoing any mirror changes. ([source](https://cdn.jsdelivr.net/gh/rubymetric/chsrc@main/README.md))

### Data & Databases

- [Idempotent Config Patchers](https://awesome-repositories.com/f/data-databases/json-patching/configuration-file-patching/idempotent-config-patchers.md) — Rewrites repository configuration files deterministically so repeated runs produce the same result.
- [Platform-Agnostic Config Patchers](https://awesome-repositories.com/f/data-databases/json-patching/configuration-file-patching/platform-agnostic-config-patchers.md) — Uses shell commands and file writes to modify configuration files identically across Linux, macOS, Windows, and BSD.

### DevOps & Infrastructure

- [Idempotent](https://awesome-repositories.com/f/devops-infrastructure/configuration-management/file-based-configuration/file-attribute-modifiers/file-patchers/idempotent.md) — Rewrites repository configuration files deterministically so repeated runs produce the same result and restoration is always possible.
- [Embedded Mirror Databases](https://awesome-repositories.com/f/devops-infrastructure/dependency-management/external-dependency-managers/external-archive-mirroring/embedded-mirror-databases.md) — Stores mirror URLs and metadata for hundreds of software targets directly in the binary.
- [Repository URL Managers](https://awesome-repositories.com/f/devops-infrastructure/repository-management/repository-url-managers.md) — Manages repository URLs by switching to mirrors or restoring original upstream sources for various software.
- [Multi-Platform Mirror Switchers](https://awesome-repositories.com/f/devops-infrastructure/repository-mirrors/multi-platform-mirror-switchers.md) — Switches package manager and software repository URLs to faster or local mirrors across operating systems and CPU architectures.
- [Unified Source Abstraction Layers](https://awesome-repositories.com/f/devops-infrastructure/unified-package-metadata-abstractions/unified-source-abstraction-layers.md) — Abstracts every package manager's config format behind a single command-line interface and common API.
- [Custom Mirror Applicators](https://awesome-repositories.com/f/devops-infrastructure/mirror-list-distributions/custom-mirror-applicators.md) — Applies a user-specified mirror URL or selects from a list of supported mirrors for any supported software target.
- [Mirror List Displays](https://awesome-repositories.com/f/devops-infrastructure/mirror-list-distributions/mirror-list-displays.md) — Displays all software, operating systems, and languages that can be mirrored, along with their mirror options. ([source](https://cdn.jsdelivr.net/gh/rubymetric/chsrc@main/README.md))

### Networking & Communication

- [Mirror Latency Selectors](https://awesome-repositories.com/f/networking-communication/dns-zone-aliasing/mirroring-for-availability/mirror-latency-selectors.md) — Measures network latency to available mirrors and automatically applies the fastest one for a given software target. ([source](https://cdn.jsdelivr.net/gh/rubymetric/chsrc@main/README.md))
- [Deterministic Config Rewriters](https://awesome-repositories.com/f/networking-communication/http-clients/host-header-rewriting/payload-rewriters/deterministic-config-rewriters.md) — Rewrites repository configuration files deterministically so repeated runs produce the same result.
- [Mirror](https://awesome-repositories.com/f/networking-communication/latency-benchmarkers/mirror.md) — Automatically measures network latency to available mirrors and selects the fastest one for a given software target.

### Operating Systems & Systems Programming

- [Multi-Platform](https://awesome-repositories.com/f/operating-systems-systems-programming/linux-package-management/mirror-configurators/multi-platform.md) — Switches package manager and software repository URLs to faster or local mirrors across different operating systems.
- [Multi-Platform Source Switchers](https://awesome-repositories.com/f/operating-systems-systems-programming/linux-package-management/mirror-configurators/multi-platform-source-switchers.md) — Changes package manager and software repository URLs to faster or local mirrors across multiple operating systems. ([source](https://cdn.jsdelivr.net/gh/rubymetric/chsrc@main/README.md))
- [Scoped Mirror Configurations](https://awesome-repositories.com/f/operating-systems-systems-programming/linux-package-management/mirror-configurators/scoped-mirror-configurations.md) — Applies mirror changes at project, user, or system level depending on target software support.

### Software Engineering & Architecture

- [Scoped Source Configurators](https://awesome-repositories.com/f/software-engineering-architecture/application-lifecycle-management/configuration-management/hierarchical-configuration-systems/multi-project-scoping/per-directory-configuration-scoping/scoped-source-configurators.md) — Supports per-project, per-user, and system-wide source changes by writing to different config paths or environment variables depending on the target.
- [Mirror Latency Probes](https://awesome-repositories.com/f/software-engineering-architecture/monotonic-time-measurement/global-latency-probes/mirror-latency-probes.md) — Measures TCP connection time to available mirrors and automatically selects the fastest one.

### Content Management & Publishing

- [Custom Mirror Applicators](https://awesome-repositories.com/f/content-management-publishing/q-a-content-strategies/custom-mirror-applicators.md) — Applies a user-chosen mirror from a list of supported sources or a custom URL provided by the user. ([source](https://cdn.jsdelivr.net/gh/rubymetric/chsrc@main/README.md))

### System Administration & Monitoring

- [Scoped Source Configurators](https://awesome-repositories.com/f/system-administration-monitoring/resource-monitoring/resource-change-monitors/source-change-monitors/scoped-source-configurators.md) — Restricts mirror changes to the current project, the current user, or the entire system. ([source](https://cdn.jsdelivr.net/gh/rubymetric/chsrc@main/README.md))
