Skip to main content
Hello! I'm Chanrich

Here I will share the problems and solutions encountered by various technology stacks, take you to understand the latest technology stacks and how to apply them in actual development, and hope that my development experience will inspire you

Introduce

Recommend Blog

New Blog

原文链接:https://zhuanlan.zhihu.com/p/111014448

自动脚本(全部国内地址)(复制下面一句脚本到终端中粘贴回车)

Mac 常规安装脚本(推荐 完全体 几分钟安装完成):

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

Mac 极速安装脚本(精简版 几秒钟安装完成):

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" speed

Mac 卸载脚本

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"

常见错误去下方地址查看

https://gitee.com/cunkai/HomebrewCN/blob/master/error.md

Linux 安装脚本:

rm Homebrew.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh ; bash Homebrew.sh

Linux 卸载脚本:

rm HomebrewUninstall.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh ; bash HomebrewUninstall.sh

ChanrichHomebrewMacOne min read

clashx

环境

macOS 13.4.1,使用 ClashX 1.115.1,ClashX 正常代理,使用自带终端。

前提

已经有Clash代理节点并能正常访问代理

前言

我们在终端使用 Homebrew、git、npm 等命令时,总会因为网络问题而安装失败。 尤其是安装 Homebrew,据我了解很多朋友是花了很长时间来解决,心里不知道吐槽该死的网络多少遍了。

设置方式

临时生效

通过设置 http_proxy、https_proxy,可以让终端走指定的代理。 配置脚本如下,在终端直接执行,只会临时生效:

export http_proxy=http://127.0.0.1:7890
export https_proxy=$http_proxy

7890 是 http 代理对应的端口,请不要照抄作业,根据你的实际情况修改。

你可以在 Clash 的设置界面中查找代理端口信息。

永久生效

function proxy_on() {
export http_proxy=http://127.0.0.1:7890
export https_proxy=\$http_proxy
echo -e "终端代理已开启。"
}

function proxy_off(){
unset http_proxy https_proxy
echo -e "终端代理已关闭。"
}

通过 proxy_on 启动代理,proxy_off 关闭代理。

接下来需要把脚本写入.bash_profile.zprofile,这样就可以永久生效。

至于你应该写入哪个文件,请根据命令 echo $SHELL 返回结果判断:

/bin/bash => .bash_profile
/bin/zsh => .zprofile

打开代理

proxy_on

关闭代理

proxy_off

参考文章:终端使用代理加速的正确方式(Clash)


ChanrichClashXClashTerminalProxy2 min read
logo
道阻且长,行则将至