🔩 An oh-my-zsh plugin to configure proxy for some packages manager and software.
Firstly, clone this repository in oh-my-zsh's plugins directory.
git clone https://github.com/sukkaw/zsh-proxy.git ~/.oh-my-zsh/custom/plugins/zsh-proxySecondly, activate the plugin in ~/.zshrc. Enable it by adding zsh-proxy to the plugins array.
plugins=(
[plugins
...]
zsh-proxy
)
Antigen is a zsh plugin manager, and it support oh-my-zsh plugin as well. You only need to add antigen bundle sukkaw/zsh-proxy to your .zshrc with your other bundle commands if you are using Antigen. Antigen will handle cloning the plugin for you automatically the next time you start zsh. You can also add the plugin to a running zsh with antigen bundle sukkaw/zsh-proxy for testing before adding it to your .zshrc.
Congratulations! Open a new terminal or run source $HOME/.zshrc. If you see following lines, you have successfully installed zsh-proxy:
========================================
You should run following command first:
$ proxyctl init
========================================
After installation, initialize and configure the plugin:
# Initialize zsh-proxy (creates configuration directory)
proxyctl init
# Configure your proxy settings
proxyctl edit
# Enable proxy
proxyctl on
# Check status
proxyctl statusDefault configuration uses 127.0.0.1:1080 for SOCKS5 proxy and 127.0.0.1:8080 for HTTP proxy. You can leave any field blank during configuration to use the default values.
Note: Currently zsh-proxy doesn't support proxy with authentication.
zsh-proxy provides a unified proxyctl command for all proxy management operations. All functionality is accessible through intuitive subcommands.
# Enable proxy with default profile
proxyctl on
# Enable proxy with specific profile (temporary for current session)
proxyctl on work
# Disable proxy
proxyctl off
# Check current IP
proxyctl ip
# Show current status
proxyctl statuszsh-proxy supports managing multiple proxy configurations (profiles) for different scenarios (work, home, VPN, etc.).
# List all available profiles
proxyctl list
# Create a new profile (will prompt for configuration)
proxyctl add work
proxyctl add home
# Edit a profile
proxyctl edit work
# Delete a profile
proxyctl delete old-profile
# Copy a profile
proxyctl copy home vpn
# Rename a profile
proxyctl rename default personal
# Show profile configuration
proxyctl show workThe default profile is used when you run proxyctl on without arguments or when starting a new shell session.
# Show current default profile
proxyctl default
# Set a new default profile
proxyctl default workNote: Using proxyctl on <profile> only switches the profile for the current session. To make it permanent across sessions, use proxyctl default <profile>.
# Initialize zsh-proxy (first-time setup)
proxyctl init
# Migrate from old configuration format
proxyctl migrate
# Update zsh-proxy plugin
proxyctl update
# Show help
proxyctl helpMigration Note: If you're upgrading from an older version, you'll be prompted to migrate your configuration on first use. Your existing settings will become the "default" profile, and old files will be backed up to ~/.zsh-proxy/legacy/.
If you install zsh-proxy with Antigen, you need to remove antigen bundle sukkaw/zsh-proxy to disable the plugin.
If you install zsh-proxy with oh-myzsh, you need to remove zsh-proxy item from plugin array, then run rm -rf ~/.oh-my-zsh/custom/plugins/zsh-proxy to remove the plugin.
And you can clean up files & folders created by zsh-proxy using following command:
$ rm -rf ~/.zsh-proxyzsh-proxy currently support those package manager & software:
http_proxyhttps_proxyftp_proxyrsync_proxyall_proxy- git (http)
- npm & yarn
- apt
- socks5 & http proxy with authentication.
- check whether the program exist before enable proxy for it
- proxy for sudo user (
env_keepor sorts of things) - proxy for:
- yum
- pip
- gradle
- git with ssh
- gem
no_proxyconfig- learn some from arch wiki
zsh-proxy © Sukka, Released under the MIT License.
Authored and maintained by Sukka with help from contributors (list).
Personal Website · Blog · GitHub @SukkaW · Telegram Channel @SukkaChannel · Twitter @isukkaw · Keybase @sukka