让 Homebrew 走代理更新 + brew 管理 node 版本

0、前言

环境:MacOS

背景:整理下今天所做的配置。

1、 让 Homebrew 走代理更新

brew update

就卡住了,即使开了 shadowsocks 也不行。因为 shadowsocks 对命令行无效。

这时可以用

export ALL_PROXY=socks5://127.0.0.1:1086

这里的 ALL_PROXY 值参考自 shadowsocks->偏好设置:

参考资料

https://www.logcg.com/archives/1617.html

2、用 brew 管理 node 版本

本来装了 n 去管理 node 版本,发现不生效,可能是跟 homebrew 冲突了吧,既然如此 brew 也可以管理。

(1)查看已经安装过的所有 node 版本

ls /usr/local/Cellar/node* 

(2)切换 node 版本

brew unlink node && brew switch node 8.4.0

(3)查看 node 版本

node -v

参考资料

https://my.oschina.net/uniquejava/blog/491030

原文地址:https://www.cnblogs.com/xjnotxj/p/7478614.html