https://github.com/spencerwooo/mihoro
Mihomo CLI client on Linux. Formerly `clashrup`.
https://github.com/spencerwooo/mihoro
clash linux mihomo proxy systemd
Last synced: 3 months ago
JSON representation
Mihomo CLI client on Linux. Formerly `clashrup`.
- Host: GitHub
- URL: https://github.com/spencerwooo/mihoro
- Owner: spencerwooo
- License: mit
- Created: 2023-01-01T08:31:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-12T03:21:07.000Z (over 1 year ago)
- Last Synced: 2025-06-01T08:33:36.667Z (about 1 year ago)
- Topics: clash, linux, mihomo, proxy, systemd
- Language: Rust
- Homepage:
- Size: 211 KB
- Stars: 61
- Watchers: 1
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
---
**mihoro** - The 🦀 Rust™-based [Mihomo](https://github.com/MetaCubeX/mihomo) CLI client on Linux.
- Setup, update, apply overrides, and manage with systemd. **No more, no less.**
- No root privilege required. Maintains per-user instance.
- First-class support for config subscription.

## Install
```shell
curl -fsSL https://raw.githubusercontent.com/spencerwooo/mihoro/main/install.sh | sh
```
Optionally, download over a mirror:
```shell
curl -fsSL https://raw.githubusercontent.com/spencerwooo/mihoro/main/install.sh | sh -s -- --mirror https://ghfast.top
```
> [!IMPORTANT]
> `mihoro` is installed to `~/.local/bin` by default. Ensure this is on your `$PATH`.
## Setup
`mihoro`, like `mihomo`, is a config-based CLI client.
After installing `mihoro`, initialize its config `~/.config/mihoro.toml` first by:
```bash
mihoro setup
```
The default config will be generated:
```toml
remote_config_url = ""
mihomo_channel = "stable"
mihomo_binary_path = "~/.local/bin/mihomo"
mihomo_config_root = "~/.config/mihomo"
user_systemd_root = "~/.config/systemd/user"
mihoro_user_agent = "mihoro"
auto_update_interval = 12
[mihomo_config]
port = 7891
socks_port = 7892
mixed_port = 7890
allow_lan = false
bind_address = "*"
mode = "rule"
log_level = "info"
ipv6 = true
external_controller = "0.0.0.0:9090"
external_ui = "ui"
geodata_mode = false
geo_auto_update = true
geo_update_interval = 24
[mihomo_config.geox_url]
geoip = "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat"
geosite = "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat"
mmdb = "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/country.mmdb"
```
**Before doing anything, fill in `remote_config_url`, which is your remote `mihomo` or `clash` subscription url.**
Example:
```toml
remote_config_url = "https://tt.vg/freeclash" # DO NOT USE THIS IF YOU CAN!
```
Customize other settings as needed, then, run setup once more:
```bash
mihoro setup
```
... to start downloading `mihomo` binary, your remote config, and geodata.
> [!CAUTION]
>
> :warning: **DISCLAIMER!** Use your own `remote_config_url` at all times! The link provided comes from a **free, third-party** Clash/Mihomo provider, and `mihoro` cannot guarantee its integrity.
## Usage
To configure proxy for the current terminal session:
```bash
eval $(mihoro proxy export)
```
To revert proxy settings:
```bash
eval $(mihoro proxy unset)
```
To check running status of `mihomo` core:
```bash
mihoro status
```
To update subscribed remote config:
```bash
mihoro update
# or explicitly: mihoro update --config
```
To apply settings changes after modifying `mihoro.toml`:
```bash
mihoro apply
```
To update `mihomo` binary (core) and/or geodata:
```bash
mihoro update --core # updates core
mihoro update --geodata # updates geodata
mihoro update --all # updates config -> core -> geodata -> restarts mihomo
```
To enable auto-update via cron job:
```bash
mihoro cron enable
```
To disable auto-update:
```bash
mihoro cron disable
```
To check auto-update status:
```bash
mihoro cron status
```
The `auto_update_interval` in `mihoro.toml` controls the update frequency in hours (default: 12, range: 1-24). Set to `0` to disable.
To upgrade `mihoro` itself to the latest version:
```bash
mihoro upgrade
```
Or check for updates without installing:
```bash
mihoro upgrade --check
```
To manually specify a target architecture (useful when auto-detection fails, e.g., on Ubuntu 20.04):
```bash
mihoro upgrade --target x86_64-unknown-linux-musl
mihoro upgrade --target aarch64-unknown-linux-musl
```
Shell auto-completions are available under `mihoro completions` for bash, fish, zsh:
```bash
# For bash:
mihoro completions bash > $XDG_CONFIG_HOME/bash_completion/mihoro # or /etc/bash_completion.d/mihoro
# For fish:
mihoro completions fish > $HOME/.config/fish/completions/mihoro.fish
# For zsh:
mihoro completions zsh > $XDG_CONFIG_HOME/zsh/completions/_mihoro # or to one of your $fpath directories
```
Full list of commands:
```console
$ mihoro --help
Mihomo CLI client on Linux.
Usage: mihoro [OPTIONS] [COMMAND]
Commands:
setup Setup mihoro by downloading mihomo binary and remote config
update Update mihomo components (config by default)
apply Apply mihomo config overrides and restart mihomo.service
start Start mihomo.service with systemctl
status Check mihomo.service status with systemctl
stop Stop mihomo.service with systemctl
restart Restart mihomo.service with systemctl
log Check mihomo.service logs with journalctl [aliases: logs]
proxy Output proxy export commands
uninstall Uninstall and remove mihoro and config
completions Generate shell completions for mihoro
cron Manage auto-update cron job
upgrade Upgrade mihoro to the latest version
help Print this message or the help of the given subcommand(s)
Options:
-m, --mihoro-config Path to mihoro config file [default: ~/.config/mihoro.toml]
-h, --help Print help
-V, --version Print version
```
## Dashboard
On controlling `mihomo` itself, we recommend using a web-based dashboard. Some options include [metacubexd](https://github.com/MetaCubeX/metacubexd), [zashboard](https://github.com/Zephyruso/zashboard), or [yacd](https://github.com/MetaCubeX/Yacd-meta).
Web-based dashboards require enabling `external_controller` under `[mihomo_config]`. Applying this config will expose `mihomo`'s control API under this address, which you can then configure your dashboard to use this as its backend.
You can also put the static files of these dashboards under the `external_ui` directory if defined. In this case, `mihomo` will serve the dashboard locally under `{external_controller}/ui`. Please refer to the official documentation of mihomo for more information: [docs/external_controller](https://wiki.metacubex.one/config/general/#api), [docs/external_ui](https://wiki.metacubex.one/config/general/#_7).
## License
[MIT](LICENSE)