[Mac] Configure Clash Proxy in VS Code

In VS Code, there are some plugins like IntelliCode, Claude Dev, etc., that may need to be accessed through a Proxy. Below is the configuration method using the Clash proxy, similar for others.

0. System Environment

macOS Sonoma 14.6.1
Clash for Windows 0.20.39

1. System Settings

If the default configuration has not been changed, Clash uses port 7890 by default. If it hasn't been changed, we can modify the system configuration file sudo vim ~/.zshrc and add the following part:

export http_proxy=http://127.0.0.1:7890
export https_proxy=$http_proxy
echo -e "Http Proxy is on."

Then restart the window or use the command to activate:

source ~/.zshrc

If you have modified it, please adjust according to your actual port number.
This way, you can use the Clash proxy in the command line. You can test it with:

curl -I "www.apple.com"

2. VS Code Configuration

Many times macOS does not correctly use the above default configuration, so we need to configure VS Code.

2.1 Configuration in Clash

You need to enable the TUN and allow WLAN options:

2.2 Configuration in VS Code

Open Code -> Settings -> Settings, search for http_proxy:
Enter http://127.0.0.1:7890:

If no issues occur, the plugins in VS Code should be able to use the Clash proxy.

Reference Materials

[1] https://kawnnor.com/wsl-vscode-proxy

Add a Comment

Your email address will not be published. Required fields are marked *