A shell script that switches a Linux distribution's package sources to domestic mirrors, plus a separate script for installing Docker and configuring registry mirrors.
RubyMetric/chsrc
A command-line tool that switches package managers and OS software sources to fast domestic mirrors across many languages and platforms.
- Stars
- 6,909
- Forks
- 283
- Open issues
- 25
- Last commit
- 2 days ago
What is it?
chsrc is a cross-platform command-line tool for changing software sources (mirrors) for programming language package managers, operating system package repositories and some other software. Running a single command such as `chsrc set node` measures the available mirrors and switches the configuration to the fastest one, or lets you pick a specific mirror or a custom URL.
It covers a wide range of targets, including npm, pip, cargo, Maven, Ubuntu, Debian, Fedora, Arch Linux, Homebrew, Docker Hub and Flathub, and it supports Linux, Windows, macOS, BSD and Android/Termux on several CPU architectures. Some tools can be configured at project scope instead of globally, and a dry-run mode prints the commands without executing them.
The project is also a C11 framework built on an MVC-style design, where each source-changing method is written as a recipe. Contributors can add new recipes, and the README points to documentation for building and contributing.
Key features
- 01Automatically measures mirror speed and switches to the fastest one with `chsrc set <dish>`.
- 02Supports language package managers such as npm, pip, cargo, Maven and Go.
- 03Supports operating system repositories including Ubuntu, Debian, Fedora, Arch and Termux.
- 04Offers project-level scope for some tools, avoiding global configuration changes.
- 05Provides a dry-run mode that prints commands without executing them.
Use cases
- Speeding up package downloads on a new machine located in mainland China.
- Configuring multiple language toolchains and Linux distributions with one tool.
- Switching a project's package manager mirror without changing global settings.
- Writing custom mirror recipes for an internal or self-hosted mirror.
Quick start
- 1
Install via Homebrew (macOS)
brew install chsrc - 2
Install via Scoop (Windows)
scoop install chsrc - 3
Install via WinGet (Windows)
winget install RubyMetric.chsrc - 4
Run chsrc to auto-benchmark and switch a package manager's source (e.g. Ruby)
chsrc set ruby
Things to know
- Changing system and package manager sources modifies global configuration, so use -dry to preview or -scope=project where supported.
- Some platforms such as FreeBSD have known recipe issues, and some architectures lack prebuilt binaries.
In collections
Topics
FAQ
- What is chsrc?
- A command-line tool that switches package managers and OS software sources to fast domestic mirrors across many languages and platforms. chsrc is a cross-platform command-line tool for changing software sources (mirrors) for programming language package managers, operating system package repositories and some other software. Running a single command such as `chsrc set node` measures the available mirrors and switches the configuration to the fastest one, or lets you pick a specific mirror or a custom URL.
- Is chsrc free to use? What license does it have?
- chsrc is open source under the GPL-3.0 license. Check the license terms before using it in commercial products.
- Is chsrc still maintained?
- Actively maintained. The last commit to chsrc was on Oct 23, 2026.
- What can I use chsrc for?
- Speeding up package downloads on a new machine located in mainland China. Configuring multiple language toolchains and Linux distributions with one tool. Switching a project's package manager mirror without changing global settings. Writing custom mirror recipes for an internal or self-hosted mirror.
- How do I install chsrc?
- Install via Homebrew (macOS): brew install chsrc Install via Scoop (Windows): scoop install chsrc Install via WinGet (Windows): winget install RubyMetric.chsrc Run chsrc to auto-benchmark and switch a package manager's source (e.g. Ruby): chsrc set ruby
- Where can I get chsrc?
- The source code and installation instructions are on GitHub: https://github.com/RubyMetric/chsrc
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
The package manager for macOS and Linux that installs command-line tools and GUI apps from its formula and cask repositories.
A free, open-source C/C++ package manager from Microsoft for installing and building libraries on Windows, macOS, and Linux.
A standalone command-line tool that watches files and directories and runs a command whenever they change.
An open-source, AI-integrated terminal for macOS, Linux and Windows that supports BYOK and local models, durable SSH sessions and inline file previews.
A minimal Rust-built statusline for Claude Code showing model, Git state, workspace, and context window usage in the terminal.