[macOS]给终端安装oh-my-zsh提高效率
macOS的终端原生就已经比Windows默认的终端用着更舒服,oh-my-zsh这个插件我之前也有所耳闻,不过一直没有投入使用过,因为之前自己终端用的也少。
今天突然想安装一下这个大名鼎鼎的终端工具,结果,安装过程并不是那么顺利。
由于这个工具是托管在GitHub上的,我默认已经开启了访问GitHub的渠道,但是不管是用GitHub的镜像还是国内Gitee的镜像来安装,都是会遇到错误:
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
把镜像改为国内的Gitee依然有错误:
Cloning Oh My Zsh... fatal: unable to access 'https://gitee.com/mirrors/oh-my-zsh.git/': Received HTTP code 405 from proxy after CONNECT /Users/wei Error: git clone of oh-my-zsh repo failed
给git加一个全局代理即可解决问题:git config --global http.proxy
或者你可以配置指定协议的代理(此处端口为clash工具,具体端口请根据自己使用的代理工具如1080):
配置socks5代理
git config --global http.proxy socks5 127.0.0.1:7890 git config --global https.proxy socks5 127.0.0.1:7890
配置http代理
git config --global http.proxy 127.0.0.1:7890 git config --global https.proxy 127.0.0.1:7890
再使用以下命令安装:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
如果不行则使用以下命令:
sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh \ | sed 's|^REPO=.*|REPO=${REPO:-mirrors/oh-my-zsh}|g' \ | sed 's|^REMOTE=.*|REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}|g')"
尽情享受一个更高效率的终端吧~
关闭代理:git config --global --unset http.proxy
![](https://afish.org/wp-content/themes/CorePress/static/img/loading.gif)
推荐几个好用的插件(需在配置文件plugin中开启并重载配置文件):
- z (智能推荐进入过的目录,输入部分字母用tab补全即可,如 z wo+tab 即可进入/Desktop/Wordpress-master)
- zsh-autosuggestions(智能推荐使用过的命令,使用方法同上,不过此插件需要另外安装)
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
版权声明:
作者:小鱼
链接:https://afish.org/index.php/2023/10/22/oh-my-zsh/
来源:小鱼的blog
文章版权归作者所有,未经允许请勿转载。
THE END
二维码
文章目录
关闭
共有 0 条评论