# macOS

面向所有遵循 macOS 网络设置的应用——Safari、邮件、App Store、多数第三方 App。

## 系统设置 UI

1. **系统设置 → 网络 → {当前接口，如 Wi-Fi} → 详细信息… → 代理**。
2. 勾选 **Web 代理 (HTTP)** 与 **安全 Web 代理 (HTTPS)**。
3. 各自填写：
   * 服务器：`gate.helodata.io`（或 ISP IP），端口：`7777`
   * 勾选 **代理服务器需要密码**，填入用户名与密码
4. **好 → 应用**。

\[screenshot: macOS 代理面板]

完整截图版本见 [Safari](/helodata-zh/ji-cheng-zhi-nan/liu-lan-qi/safari.md)。

## CLI 工具

curl、wget、brew、npm 及多数 Unix 工具读环境变量。加入 `~/.zshrc` 或 `~/.bash_profile`：

```bash
export HTTP_PROXY="http://helo_s1a2b3c4d5e-type-res-region-us:PASSWORD@gate.helodata.io:7777"
export HTTPS_PROXY="$HTTP_PROXY"
export NO_PROXY="localhost,127.0.0.1,*.local"
```

重载 shell 后，`curl https://ipv4.icanhazip.com` 应返回 helodata 的 IP。

仅本会话有效时省略 rc 文件直接执行即可。

## `networksetup`（脚本化）

```bash
# 开启
sudo networksetup -setwebproxy "Wi-Fi" gate.helodata.io 7777 on \
     "helo_s1a2b3c4d5e-type-res-region-us" "PASSWORD"
sudo networksetup -setsecurewebproxy "Wi-Fi" gate.helodata.io 7777 on \
     "helo_s1a2b3c4d5e-type-res-region-us" "PASSWORD"

# 关闭
sudo networksetup -setwebproxystate "Wi-Fi" off
sudo networksetup -setsecurewebproxystate "Wi-Fi" off
```

`Wi-Fi` 换成当前接口名（用 `networksetup -listallnetworkservices` 列出）。

## 应用代理 vs 系统代理

GUI 应用走系统设置代理，CLI 应用走环境变量——**两套系统**，统一行为时两边都要配。

## 验证

```bash
curl https://ipv4.icanhazip.com
```

## 常见陷阱

* **`.local` 自动绕过** — macOS 默认绕过 `.local` 与链路本地地址，对 Bonjour 有用但留意 bypass 清单。
* **`networksetup` 需 sudo**。
* **Big Sur 之后需在系统设置中点"应用"**——不点不生效。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.helodata.com/helodata-zh/ji-cheng-zhi-nan/cao-zuo-xi-tong/macos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
