A lightweight, cross-platform helper that automates and simplifies proxy configuration from your zsh session.
macOS • Linux • WSL • Any system with zsh & Git •
- Auto-detect system proxies on macOS (falls back gracefully on other OSes)
- One zstyle per proxy kind — provide full URIs, no more server/port pairs
- Mirrors lowercase ↔ uppercase env vars (
http_proxy→HTTP_PROXY, etc.) - Toggle setters — call
set_http_proxy <uri>to set, call with no arg to unset - Git integration (
http.proxy,https.proxy) follows the same precedence
zsh5.0 or latergitif you want Git proxy auto-config- On macOS: network proxies should be configured in System Settings → Network (the plugin reads them via native commands)
Note: No external dependencies or Python/Ruby helpers — pure zsh.
git clone https://github.com/huadeity/zsh-proxy.git ${ZDOTDIR}/plugins/zsh-proxy
echo 'source ${ZDOTDIR}/plugins/zsh-proxy/zsh-proxy.zsh'antidote install huadeity/zsh-proxy
zmodule huadeity/zsh-proxy
zcomet load huadeity/zsh-proxy
zgenom load huadeity/zsh-proxy
# Inside custom plugins dir
git clone https://github.com/huadeity/zsh-proxy.git \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-proxy
# ~/.zshrc
plugins=( ... zsh-proxy )proxy # auto-configure from zstyle → OS
noproxy # clear everything (env + Git)
proxys # Show all proxy settings| Function | Action |
|---|---|
set_proxy PLUGIN TYPE PROXY |
Set proxy for specifig app with specifig protocal type |
unset_proxy PLUGIN TYPE |
Unset proxy for specifig app with specifig protocal type |
# ~/.zshrc or ~/.zshenv
zstyle ':plugin:proxy' http '192.168.1.2:7890'
zstyle ':plugin:proxy' https '192.168.1.2:7890'
zstyle ':plugin:proxy' socks '127.0.0.1:8888'
zstyle ':plugin:proxy' mixed '127.0.0.1:8888'
zstyle ':plugin:proxy' no 'localhost,127.0.0.1,.internal'
zstyle ':plugin:proxy' type http https all no # default
zstyle ':plugin:proxy' plugins shells # default
# Run automatically on shell startup
zstyle ':plugin:proxy' auto yes # default: noCall proxy manually at any time to reload settings.
- zstyle lookup—User-defined URIs for each proxy kind have highest priority.
- macOS system proxy—When on macOS & helper functions available, the plugin queries the active network service for
web,secureweb, andsocksfirewallproxies. - Fallback: If nothing is found, environment variables are unset.
- Git:
git config --global http(s).proxyis kept in sync with the chosen URIs (or removed when proxies are unset).
Everything is handled in pure zsh — no forks unless Git commands are needed.
- Update to New Level (2025-05-03): Enhanced functionality and performance improvements as per the latest commit. Check the plugins directory for updated or new proxy management features.
Pull requests are welcome! Feel free to improve Linux/WSL auto-detection, add tests for other shells, or polish the README.
MIT