---
title: "Mac 上的“curl: (56) Failure when receiving data”· Kilobat 指南"
url: "https://kilobat.app/zh-hans/guides/curl-56-failure-receiving-data"
description: "Mac 上的 curl 以 (56) Failure when receiving data 停止。传输过程中连接断了。检查代理、VPN 和服务器。"
---

# Mac 上的“curl: (56) Failure when receiving data”

curl 退出码 56 表示某个步骤失败。curl 文档的说法是：“Failure with receiving network data.”

**让你的智能体来解决**拷贝一条提示词，适用于 Claude Code、Codex 或任何能使用终端的智能体。

我的 Mac 出现了这个问题：Mac 上的“curl: (56) Failure when receiving data”。请阅读 https://kilobat.app/zh-hans/guides/curl-56-failure-receiving-data.md，并和我一起逐步处理。如果缺少 Kilobat CLI，请安装：brew install seifip/kilobat/kilobat。请你自己运行指南中的终端和 kilobat 检查，并告诉我发现了什么。列出只有我才能完成的步骤。更改任何设置之前先问我。

适用于：所有当前 macOS 版本上 macOS 自带的 curl 和 Homebrew 版 curl。 · 核查日期：2026年10月29日

## 症状

- 终端显示 `curl: (56) Failure when receiving data from the peer` 或类似的一行。
- 下载开始后又停了。
- 文字中可能还有“Connection reset by peer”。

## 可能的原因

- **连接被重置。**服务器、代理或防火墙在数据传输过程中关闭了连接。
- **VPN 或网络变化。**VPN 重新连接或 Wi-Fi 切换会中断传输。
- **代理拦截了内容。**过滤器可能会切断它不允许的响应。
- **服务器故障。**服务器在发送较长的响应时可能出错。

## 如何检查

1. 用详细信息运行 curl。记下失败是从什么时候开始的。

   ```
   curl -v https://example.com
   ```
2. 换一个网络重试，例如手机热点。
3. 显示代理环境变量。

   ```
   env | grep -i proxy
   ```
4. 传输期间检查 Wi-Fi 链路。

   ```
   kilobat wifi
   ```

## 如何修复

1. 重试传输。在脚本中加入重试。

   ```
   curl --retry 3 -O https://example.com/file.zip
   ```
2. 为了测试，暂时关闭 VPN、代理或安全类 App，之后再打开。
3. 用 `-C -` 续传下载。

   ```
   curl -C - -O https://example.com/file.zip
   ```
4. 如果只在某一个网络上失败，请向它的管理员询问过滤情况。

## 使用 Kilobat

1. Kilobat 的连接诊断会逐层测试这个地址：网络、代理、DNS、规则、IPv4、IPv6、TLS 和服务器，并指出失败的那一层。

   ```
   kilobat why https://example.com
   ```
2. Kilobat 的这些检查都是免费的。AI 智能体可以通过 MCP 用 `diagnose_connection` 和 `diagnose_network` 运行它们。请参阅[找出某个网站或 API 连不上的原因](https://kilobat.app/zh-hans/guides/recipes/why-cant-it-connect)。

## 常见问题

**(56) 和 ECONNRESET 一样吗？**

连接被重置是可能的原因之一。参见[Mac 上的“npm error code ECONNRESET”](https://kilobat.app/zh-hans/guides/npm-econnreset)。

**这能证明服务器有故障吗？**

不能。路径上的其他设备也可能关闭连接。

## 参考资料

- [curl：libcurl error codes](https://curl.se/libcurl/c/libcurl-errors.html)

核查日期：2026 年 10 月 29 日。

## 相关指南

- [Mac 上的“curl: (7) Failed to connect”](https://kilobat.app/zh-hans/guides/curl-7-failed-to-connect): curl 退出码 7 表示某个步骤失败。
- [Mac 上出现“npm error code ECONNRESET”](https://kilobat.app/zh-hans/guides/npm-econnreset): ECONNRESET 表示连接被强制重置。
- [Mac 上 Chrome 中的 ERR_CONNECTION_RESET](https://kilobat.app/zh-hans/guides/err-connection-reset): ERR_CONNECTION_RESET 是 Chrome 的网络错误。
- [Mac 上 Homebrew 失败并提示“curl: (28)”](https://kilobat.app/zh-hans/guides/homebrew-curl-28-timed-out): Homebrew 通过 curl 下载。
