Monday, September 24, 2018

[摘记]Mac下的终端使用代理翻墙的方法

Mac下使用终端homebrew安装软件就像linux下的apt-get一样,因为有GFW/墙的存在,常常会因为无法连接而导致安装软件失败,以安装telenet工具nally为例:

$ brew cask install nally
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (phinze/cask, homebrew/cask).

==> Satisfying dependencies
==> Downloading https://yllan.github.com/nally/download/Nally-1.4.9.app.zip
######################################################################## 100.0%
curl: (56) Recv failure: Connection reset by peer
Error: Download failed on Cask 'nally' with message: Download failed: https://yllan.github.com/nally/download/Nally-1.4.9.app.zip
如果有ssr代理,则可以通过输入:
$ export ALL_PROXY=socks5://127.0.0.1:1080
并查看是代理否设置成功:
$ curl ip.gs
然后就可以愉快地看到:
Updating Homebrew...
==> Satisfying dependencies
==> Downloading https://yllan.github.com/nally/download/Nally-1.4.9.app.zip
######################################################################## 100.0%
==> Verifying checksum for Cask nally
==> Installing Cask nally
==> Moving App 'Nally.app' to '/Applications/Nally.app'.
🍺  nally was successfully installed!

参考: 
让终端走代理的几种方法

No comments: