SwitchEnvs 是一个管理、切换多个环境变量方案的工具,可视化对本机环境变量进行增删改查。(类似于 SwitchHosts )
Github 地址: https://github.com/dean2021/SwitchEnvs
README 如下:
A desktop environment variable management tool built with Wails (Go + React/TypeScript). SwitchEnvs allows you to manage, save, and switch between multiple environment variable configurations with ease.

~/.switch_env)# Install Wails CLI if not already installed
go install github.com/wailsapp/wails/v2/cmd/wails@latest
# Clone and setup
git clone https://github.com/dean2021/SwitchEnvs.git
cd SwitchEnvs
# Install frontend dependencies
cd frontend && npm install
# Return to project root
cd ..
Run the application in development mode with hot reload:
wails dev
This will start both the Go backend and the React frontend with automatic rebuilding.
Build the production version:
wails build
Build for specific platforms:
# macOS ARM64
wails build -platform darwin/arm64
# Windows AMD64
wails build -platform windows/amd64
# Linux
wails build -platform linux/amd64
SwitchEnvs/
├── app.go # Main application logic (Go)
├── main.go # Application entry point
├── wails.json # Wails configuration
├── frontend/ # React frontend
│ ├── src/
│ │ ├── App.tsx # Main React component
│ │ ├── main.tsx # React entry point
│ │ ├── style.css # Global styles
│ │ └── types/ # TypeScript type definitions
│ ├── package.json
│ └── vite.config.ts
└── build/ # Build configurations
| Path | Purpose |
|---|---|
~/.switchenvs/schemes.json |
All saved schemes in JSON format |
~/.switchenvs/applied_scheme.json |
Persisted applied scheme name |
~/.switch_env |
Shell script with export KEY="value" entries |
The Go backend handles:
The frontend provides:
SwitchEnvs writes environment variables to ~/.switch_env and automatically adds a source command to ~/.zshrc. To use the environment variables in your terminal:
source ~/.switch_env
Or restart your terminal session.
MIT License
1
ZiLong 3 天前
前几天再用 switchhosts 的时候还在想为啥没把环境管理做一起,因为本地启动多个微服务,很多配置项用环境管理更简单
|
2
junjian2016 OP @ZiLong 欢迎使用
|
3
efxy107 1 天前
|
4
junjian2016 OP @efxy107 目前仅支持 MACOS ,这两天可以把 Windows 支持也加上去
|
5
efxy107 18 小时 58 分钟前
@junjian2016 #4 好的,更新后可以通知下我在试试;我是想用来切换不同 aicoding 中转站对应的秘钥
|