Hostly

April 29, 2026 · View on GitHub

Language: English | 中文简体

Hostly (Minimalist Hosts Switcher)

An ultra-lightweight, high-performance Hosts management tool built on Tauri v2 + Rust. By removing the frontend framework (migrating to Vanilla JS), we have pushed size and performance to the extreme.

Hostly Main Interface

🤖 Special Note: This project was deeply designed and implemented with the help of the AI agent, pursuing ultimate simplicity and efficiency.

✨ Core Features

  • 🚀 Lightning Fast: Built with JS + Native CSS. Single-file app size is ~1MB with millisecond cold-start.
  • 🎨 Modern UI & Personalization: Supports sidebar drag-to-resize, built-in Light/Dark themes, and window size memory.
  • Optimized Startup Experience: Startup performance and visuals optimized for various system environments.
  • 🔔 Non-Intrusive Feedback: Built-in lightweight Toast notification system — say goodbye to disruptive confirmation dialogs.
  • 🛡️ Smart Privilege Escalation: Automatically detects admin privileges and escalates on demand, supporting direct editing of the system Hosts file.
  • ⚙️ Dual-Mode Operation: Fully supports GUI visual operation and professional CLI command-line invocation.
  • 🤖 Headless CLI: Provides a standalone hostly-core binary, designed for server/CI environments with zero GUI dependencies.
  • 🔄 Migration Support: Supports importing SwitchHosts configurations for a seamless transition.
  • ☁️ Remote Subscriptions: Supports adding remote Hosts sources (HTTP/HTTPS), silently auto-updated by a background scheduler.
  • 🍎 Universal Architecture Support: Builds for macOS (Intel & Apple Silicon), as well as Windows and Linux.
  • 🔌 Data Portability: Supports full configuration import/export as text files.

🧩 Feature Details

  • UI Interaction:
    • Drag to Resize: Drag the left divider to customize sidebar width; the app remembers your preference.
    • Theme Follow: Automatically applies the system or last-used theme on startup for a smooth visual experience.
  • Sidebar Layout: Unified management of "System Backup", "Public Config", and "Custom Environments".
  • Multi-Mode Support:
    • Single-Select Mode: Mutually exclusive switching to keep hosts clean.
    • Multi-Select Mode: Multiple environments can be stacked and activated simultaneously.
  • Command Line (CLI): Full sub-command support, available in two modes:
    • hostly: Distributed with the GUI, suitable for desktop users, supports open/list/export and more.
    • hostly-core: Pure CLI version, smaller footprint, no GUI dependency, ideal for automation scripts.
  • Remote Config & Auto-Update:
    • Subscriptions: Add a URL to subscribe to a remote config with a customizable update interval (default: 1 hour).
    • Interactive Status Bar: When a remote config is selected, the bottom status bar shows live update status with a one-click force-refresh button.
    • Background Scheduling: Built-in smart scheduler (activates 5 seconds after startup) silently performs updates in the background without blocking the UI.

Hostly Main Interface

Hostly Main Interface

Hostly Main Interface

🚀 Quick Start

Build & Run

# After cloning the project
npm install

# Enter development mode
npm run tauri dev

# Build release package (output in src-tauri/target/release/)
npm run tauri build

Common CLI Commands

You can use hostly, hostly-core, or the released Windows CLI binaries to run the following commands:

Tip: On Windows, hostly-cli-elevated-win-x64.exe automatically requests UAC elevation. hostly-cli-win-x64.exe must be run as Administrator manually.

CommandDescriptionExample
listList all configurations and their statushostly list
openActivate one or more environmentshostly open --names Dev Test --multi
closeDeactivate a specified environmenthostly close --names Dev
multi / singleToggle global selection modehostly multi
exportExport configuration or backuphostly export --target global.json
importImport configuration or backuphostly import --target    global.json   single.txt  or an http/https URL
migrationMigrate a SwitchHosts backuphostly migration --target swV4_backup.json

Example: hostly-cli-elevated-win-x64.exe import ycf --target hosts.txt --open --single Switches to single-select mode, imports hosts.txt into "ycf" and activates it. Creates "ycf" if it doesn't exist.

Example: hostly-cli-elevated-win-x64.exe import ycf --target hosts.txt --open --multi Switches to multi-select mode, imports hosts.txt into "ycf" and activates it. Creates "ycf" if it doesn't exist.

Example: hostly-cli-elevated-win-x64.exe import ycf --target http://localhost:8080/hosts.txt --open --multi Switches to multi-select mode, imports the remote hosts.txt into "ycf" and activates it. Creates "ycf" if it doesn't exist.

🛠️ FAQ

Q: Why is the generated app so small?

A: Because we use the browser's native DOM operations and native CSS directly, with zero dependency on any heavy third-party libraries (like React/Vue/Tailwind, etc.), achieving the ultimate minimal runtime overhead and file size (~1MB).


Q: Which download is recommended?

A:

  • Windows GUI: Regular users are recommended to download hostly-gui-elevated-win-x64.exe. If you want a non-elevating GUI build, download hostly-gui-win-x64.exe and right-click → Run as Administrator when needed.
  • Windows CLI: Use hostly-cli-elevated-win-x64.exe for automatic UAC prompts, or hostly-cli-win-x64.exe if you prefer to manage Administrator privileges manually.
  • macOS (Apple Silicon / M1/M2...): Download the version with the aarch64 or universal suffix.
  • macOS (Intel): Download the version with the x86_64 or universal suffix.

⚠️ macOS Users Note: If you see "app is damaged and can't be opened", this is due to unsigned app security restrictions. Run the following command in Terminal to fix it:

xattr -cr /Applications/Hostly.app

Q: Can't open with double-click or getting a permission error?

A: Please check which version you are using:

  • hostly-gui-elevated-win-x64.exe: Has built-in auto-elevation logic; a UAC prompt will appear on startup — click "Yes" to allow.
  • hostly-cli-elevated-win-x64.exe: Has built-in auto-elevation logic for CLI commands and will relaunch through UAC when needed.
  • hostly-gui-win-x64.exe / hostly-cli-win-x64.exe: These builds do not include auto-elevation. You must right-click → Run as Administrator, or go to Properties → Compatibility → check "Run this program as an administrator" for permanent elevation.

Q: Getting "Permission Denied" on macOS or Linux?

A: Modifying the system hosts file is a privileged operation.

  • Linux: Run with sudo ./hostly-core-linux-x64.
  • macOS: The GUI version will automatically prompt for a password. For CLI, ensure you have run with sudo or have the appropriate permissions beforehand.

Q: Why does a new window briefly pop up and close after running a CLI command?

A: This is because the main process was launched without admin privileges. To gain the necessary permissions, it spawns a new admin child process to execute the command. This is normal Windows security behavior. --

Q: How do I migrate my SwitchHosts backup?

A:

  • GUI: Click the "Import" button in the sidebar and directly select the SwitchHosts backup JSON file — it will be auto-detected.
  • CLI: Use the dedicated migration command: hostly migration --target sw_backup.json. --

📄 License

MIT