A Rust-based CLI tool for managing your shell environment variables. It allows you to switch between different profiles and handles dependencies automatically. It also provides a TUI (Terminal User Interface) for visual management.
em -h # Show help informationThis tool uses the TOML format to store environment variable configurations. Profiles are stored in the ~/.config/env-manage/profiles directory by default.
global.toml: A special profile located at~/.config/env-manage/global.tomlthat is automatically loaded every time the terminal starts.
Each profile consists of two parts:
- variables: A list of key-value pairs representing the environment variables to be set.
- profiles: A list of other profiles that the current profile depends on.
Example configuration:
profiles = []
[variables]
https_proxy = "http://172.26.240.1:7890"
all_proxy = "http://172.26.240.1:7890"
http_proxy = "http://172.26.240.1:7890"- Profile Management: Create and organize environment variables into different profiles.
- Dependency Resolution: Handle complex dependencies between profiles.
- TUI Interface: Terminal user interface for intuitive configuration management.
- Shell Integration: Support for Bash, Zsh, Fish, and PowerShell.
Automated installation scripts are available for the following shells. These scripts will download the latest binary and configure your shell environment.
curl -fsSL https://raw.githubusercontent.com/zhangzhenxiang666/env-manager/main/scripts/install_bash.sh | bashcurl -fsSL https://raw.githubusercontent.com/zhangzhenxiang666/env-manager/main/scripts/install_zsh.sh | bashcurl -fsSL https://raw.githubusercontent.com/zhangzhenxiang666/env-manager/main/scripts/install_fish.sh | bashirm https://raw.githubusercontent.com/zhangzhenxiang666/env-manager/main/scripts/install_powershell.ps1 | iexIf you prefer to install manually:
-
Download the binary from the Releases page.
-
Place it in a directory of your choice. Note: You do not need to add this directory to your system
PATH. -
Add the initialization command to your shell configuration file. Replace
/path/to/env-managewith the actual path to your binary.-
Bash (
~/.bashrc):eval "$(/path/to/env-manage init bash)"
-
Zsh (
~/.zshrc):eval "$(/path/to/env-manage init zsh)"
-
Fish (
~/.config/fish/config.fish):/path/to/env-manage init fish | source
-
PowerShell (
$PROFILE):Invoke-Expression (& "C:\path\to\env-manage.exe" init powershell | Out-String)
-
Note: After installation, please restart your terminal or run
source ~/.bashrc(or the equivalent config file) to load the configuration.
Run the following command to start the TUI:
em ui-
Temporarily Load Environment Variables:
Load specified profiles or set variables directly in the current session.
em use <profile_name or key=value>... # Aliases: em activate
Example:
em use profile1 profile2 http_proxy=http://172.26.240.1:7890 -
Unload Environment Variables:
Remove specified profiles or variables from the current session.
em unuse <profile_name or key>... # Aliases: em deactivate, em drop
Example:
em unuse profile1 profile2 http_proxy -
Check Status:
Check the current environment status and consistency.
em check
-
Fix Consistency Issues:
Attempt to fix inconsistencies in the environment variable configuration.
em fix
By default, profiles are stored in the ~/.config/env-manage/profiles directory.

