惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
Troy Hunt's Blog
S
Schneier on Security
C
Cybersecurity and Infrastructure Security Agency CISA
C
CXSECURITY Database RSS Feed - CXSecurity.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Security Latest
Security Latest
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MyScale Blog
MyScale Blog
Recorded Future
Recorded Future
A
About on SuperTechFans
PCI Perspectives
PCI Perspectives
H
Help Net Security
量子位
Blog — PlanetScale
Blog — PlanetScale
云风的 BLOG
云风的 BLOG
S
Security @ Cisco Blogs
The Hacker News
The Hacker News
P
Privacy International News Feed
Hacker News: Ask HN
Hacker News: Ask HN
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
N
Netflix TechBlog - Medium
N
News and Events Feed by Topic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Threatpost
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Simon Willison's Weblog
Simon Willison's Weblog
有赞技术团队
有赞技术团队
博客园 - 司徒正美
J
Java Code Geeks
S
Securelist
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Security Archives - TechRepublic
Security Archives - TechRepublic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 叶小钗
S
Secure Thoughts
Latest news
Latest news
S
Security Affairs
T
The Exploit Database - CXSecurity.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
I
Intezer
雷峰网
雷峰网
Hacker News - Newest:
Hacker News - Newest: "LLM"
Engineering at Meta
Engineering at Meta
Hugging Face - Blog
Hugging Face - Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org

Super Blog

[译] 我所知道的全部智能体工程技巧(2026 年 6 月) 2024:悲观者正确,乐观者前行 Overleaf LaTeX citation 无法正常显示问题解决 我和我的 2023 新起点 使用 Arc 浏览器自定义网页 我和我的 2022 Genius Bar 两日游 实训小记 《软件测试技术》笔记 Q-Learning 简介 软件测试技术实验 3 和 4 遇到的一些问题和解决方案 我和我的 2021 写过的第二个 App 在 SwiftUI 中自定义修饰器 关于最近,以及…… 《数据库原理》笔记 《数字逻辑与数字系统》笔记 《形式化方法》笔记 宣言
Mac 终端无法联网问题解决
SUPER · 2024-12-21 · via Super Blog

神奇的 macOS。

问题

今天本想装个东西,但 brew update 时一直报 could not resolve host。第一时间觉得是 Clash 的问题,于是设置了 proxy,但仍未解决,尝试 unset 但也无济于事。

后来发现不仅对于 github.com 报错,甚至对镜像 mirrors.tuna.tsinghua.edu.cn 也报错,ping 了一下 github.combaidu.com,果然都不通。因此并不是 proxy 的问题。

尝试 ping 8.8.8.8,发现可以通。因此原因基本可以锁定是 DNS 设置的问题。

但之前从未更改过 Mac 的 DNS 设置,为什么终端突然不能联网了呢?尝试在 Settings - Wi-Fi - Details - DNS - DNS Servers 添加了两个阿里云的 DNS Server:223.5.5.5223.6.6.6,并刷新 DNS 缓存:

1
2
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

稍等几分钟后,终端网络恢复正常。

总结

当 Mac 终端无法联网时,大多是因为两种情况:proxy 和 DNS,首先可以通过 ping 一个 IP(如 ping 8.8.8.8)检查是否是 DNS 的问题。

如果是 DNS 的问题,手动在 Settings - Wi-Fi - Details - DNS - DNS Servers 处添加公共 DNS Server(如 223.5.5.5223.6.6.6)并刷新缓存:

1
2
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

这种方式在大多数情况下应该都可以解决 DNS 问题导致的网络连接问题。