Skip to content

kelaocai/proxy-sw

Repository files navigation

proxy-sw

English | 中文

proxy-sw is a macOS-first CLI for managing terminal proxy environment variables for local proxy tools like Clash.

Scope

Version 1 now focuses on shell proxy environment management with automatic no_proxy generation.

  • Manages shell http_proxy, https_proxy, all_proxy, and no_proxy
  • Automatically detects local private networks and adds them to no_proxy
  • Stores defaults in ~/.config/proxy-sw/config.yaml
  • Ships as a single Go binary
  • Designed for Homebrew tap installation
  • Keeps macOS system proxy support under proxy-sw system ... for advanced use, including syncing generated no_proxy values to macOS proxy bypass domains on system on

Out of scope for v1:

  • Starting or checking Clash itself
  • Linux or Windows proxy management
  • Tool-specific proxy config for git, npm, pip, and similar tools

Install

Homebrew tap

brew tap kelaocai/tap
brew install proxy-sw

When upgrading from an older installed version, run:

brew update
brew upgrade proxy-sw

After install, proxy-sw reads and writes its default config at:

~/.config/proxy-sw/config.yaml

Until the first tagged release is published, build locally:

git clone https://github.com/kelaocai/proxy-sw.git
cd proxy-sw
make build

For a local user-style install without Homebrew:

make install-local
export PATH="$HOME/.local/bin:$PATH"
proxy-sw --help

Commands

proxy-sw set --host 127.0.0.1 --port 7897
proxy-sw on
proxy-sw detect
proxy-sw doctor
proxy-sw status
proxy-sw off

Quick Start

For most users, this is the full setup flow:

proxy-sw set --host 127.0.0.1 --port 7897
proxy-sw on
proxy-sw detect
proxy-sw doctor

This saves your proxy defaults to ~/.config/proxy-sw/config.yaml, and proxy-sw on writes the managed proxy block into your shell config file such as ~/.zshrc.

Turn it off later with:

proxy-sw off

Advanced usage:

  • on automatically regenerates no_proxy from current local private networks
  • set --no-proxy-add a,b adds custom no_proxy entries
  • set --no-proxy-clear-custom clears custom no_proxy entries
  • proxy-sw system on|off|status manages macOS system proxy when you explicitly need it, and system on syncs the generated no_proxy list into macOS proxy bypass domains
  • proxy-sw system status shows the current macOS bypass domain list as bypass
  • proxy-sw list and proxy-sw use "Wi-Fi" are only needed for proxy-sw system ...

Config

Default config path used by set, on, status, detect, doctor, and system:

~/.config/proxy-sw/config.yaml

Example:

host: 127.0.0.1
port: 7897
shell_type: zsh
no_proxy_custom:
  - internal.example.com
  - "*.corp.local"
network_service: Wi-Fi

Release

  • Tag a release like v0.1.0
  • GitHub Actions builds macOS arm64 and amd64 archives
  • The release workflow publishes assets to GitHub Releases
  • The tap sync workflow updates packaging/homebrew/proxy-sw.rb into the tap repo

About

proxy-sw is a lightweight shell proxy switcher for macOS that toggles http_proxy and no_proxy in ~/.zshrc with a single command, making it easy to switch between proxied and direct terminal access.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors