背景
追踪让 Hermes Agent 在 macOS 上正常工作的所有外部依赖,方便新机器快速复现环境。
已安装组件
| 组件 | 功用 | 安装方法 | 日期 |
|---|---|---|---|
| Kimi API | AI 模型访问 | Kimi For Coding App + User-Agent fix | 2026-04-11 |
| Google Chrome | 浏览器自动化 | 官网下载 | - |
| nowplaying-cli | 全局媒体控制 | brew install nowplaying-cli | 2026-04-11 |
| 辅助功能权限 | 允许系统按键 | 系统设置 -> 隐私与安全 | 2026-04-11 |
| Fallback 配置 | 模型自动切换 | OpenRouter -> Codex -> Copilot | 2026-04-11 |
工具详解
yt-dlp + ffmpeg
yt-dlp 者,视频下载之利器也,支持 YouTube、Bilibili 等千余种站点。
常用场景:
yt-dlp "URL"-> 下载视频- 自动调用 ffmpeg 合并音视频、转格式
- AI 场景:下载视频 -> 转文字 -> 总结内容
# 示例:下载并提取音频
yt-dlp -x --audio-format mp3 "URL"
imagemagick
功用:
- 批量压缩图片、转换格式(PNG -> JPG -> WebP)
- 添加水印、调整尺寸
- AI 场景:批量处理截图,优化后上传
# 示例:压缩图片 50%
convert input.jpg -resize 50% output.jpg
pandoc
功用:
- Markdown -> Word -> PDF 互转
- 博客导出成 DOCX 审阅
- AI 场景:多 Markdown 合并为 PDF 电子书
# 示例:Markdown 转 PDF
pandoc input.md -o output.pdf
tree
功用:
- 生成目录结构图
- 文档展示项目结构
- AI 场景:代码库分析,生成结构图
# 示例:生成前3层目录
tree -L 3 -I 'node_modules|__pycache__'
jq
功用:
- 命令行处理 JSON
- 从 API 响应提取信息
- AI 场景:API 数据 -> 筛选 -> 报告
# 示例:提取 JSON 中的 name 字段
cat data.json | jq '.users[].name'
新机器快速配置
# 1. Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 2. 媒体控制
brew install nowplaying-cli
# 3. 媒体处理
brew install yt-dlp ffmpeg imagemagick
# 4. 文档/数据处理
brew install pandoc tree jq
# 5. Chrome + Kimi For Coding 手动安装
# 6. 系统设置 -> 隐私与安全 -> 辅助功能 -> 添加 Terminal
Hermes 配置
关键配置项
~/.hermes/config.yaml
model:
default: kimi-k2.5
provider: kimi-coding
base_url: https://api.kimi.com/coding/v1
fallback_providers:
- provider: openrouter
model: google/gemini-3-flash-preview
- provider: openai-codex
model: gpt-5.2-codex
- provider: copilot
model: gpt-5.2-codex
源码修改(User-Agent 修复)
修复 Kimi 403 错误需修改以下文件:
| 文件 | 修改位置数 | 作用 |
|---|---|---|
agent/auxiliary_client.py | 5 | Auxiliary client (vision, compression, flush) |
run_agent.py | 2 | Main agent client |
hermes_cli/doctor.py | 1 | Health check diagnostics |
修改内容:
# Before
"User-Agent": "KimiCLI/1.30.0"
# After
"User-Agent": "claude-code/1.0"
验证命令
# 检查当前模型配置
hermes config show
# 检查 gateway 状态
hermes gateway status
# 重启 gateway
hermes gateway restart
总结
关键要点:
- Homebrew 为 macOS 包管理基础
- yt-dlp + ffmpeg 处理媒体下载与转码
- pandoc 实现文档格式转换
- jq 处理 JSON 数据
- User-Agent 修复解决 Kimi 403 错误
适用场景:macOS 上部署 Hermes Agent,需要媒体处理、文档转换能力
不适用场景:无需本地媒体处理,仅使用云端 API
参考
- 旧 GitHub Pages 已发布页面内容迁回 source post。