Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

让 macOS 终端也能用上 SSR #55

Closed
Dream4ever opened this issue Aug 5, 2018 · 0 comments
Closed

让 macOS 终端也能用上 SSR #55

Dream4ever opened this issue Aug 5, 2018 · 0 comments
Labels
Software About installation ande usage

Comments

@Dream4ever
Copy link
Owner

需求描述

虽然在 macOS 上安装了 SSR 客户端,但是在终端中还是没法使用 SSR 的。因此即使设置了 npm 的源用的国内淘宝的源,有时候下载依赖还是会从国外的服务器下载,然后就下载不过来。

应用过程

Google iterm use socks proxy,在 V2EX 上看到了一个有效的方法:
有什么方法可以让 Terminal (iTerm) 走 socks5
。同时结合另一篇文章中的思路:Mac OSX终端走shadowsocks代理,整理出如下的操作过程:

先在终端中用 curl ip.cn 检查本机 IP,确认终端目前没有用到代理。

$ curl ip.cn
当前 IP:*.*.*.* 来自:山东省青岛市 移动

由于已在 SSR 客户端软件中设置代理地址为 socks5://127.0.0.1:1080,因此在终端中用如下命令,让 HTTP 协议走 SOCKS5:

$ export http_proxy=socks5://127.0.0.1:1080

然后再检查本机 IP,确保代理设置生效:

$ curl ip.cn
当前 IP:*.*.*.* 来自:日本

这个时候,就可以放心地下载 npm 依赖了。下载完成后,在终端中再执行命令 unset http_proxy,恢复 HTTP 代理为默认设置。

@Dream4ever Dream4ever added the Software About installation ande usage label Aug 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Software About installation ande usage
Projects
None yet
Development

No branches or pull requests

1 participant