> 零插件 · 零成本 · 智能过滤 · 离线优先
本方案使用 Syncthing(开源 P2P 同步工具)实现 Mac 与 iPhone 之间的 Obsidian vault 双向同步,无需 iCloud、无需 Obsidian Sync 订阅、无需任何 Obsidian 插件。
| 特性 | 本方案 | Obsidian Sync | iCloud |
|---|---|---|---|
| ------ | -------- | --------------- | -------- |
| 费用 | 免费 | $4/月 | 免费(5GB) |
| 插件依赖 | 无 | 无 | 无 |
| 智能大文件过滤 | ✅ 支持 | ❌ | ❌ |
| 离线可用 | ✅ | ✅ | ⚠️ 需预同步 |
| 去中心化 | ✅ P2P直连 | ❌ 云端中转 | ❌ Apple服务器 |
| 端到端加密 | ✅ | ✅ | ❌ |
| 跨平台 | ✅ 全平台 | ✅ 全平台 | 仅 Apple |
┌─────────────┐ Syncthing (P2P) ┌─────────────┐
│ Mac │◄──────────────────────────────►│ iPhone │
│ │ 端到端加密 · 局域网直连 │ │
│ Syncthing │ 无需第三方服务器 │ Möbius Sync │
│ (服务端) │ │ (客户端) │
│ │ │ │
│ Obsidian │ │ Obsidian │
│ Vault/ │ │ 本地目录/ │
│ ... │ │ ... │
└─────────────┘ └─────────────┘
同步时自动排除以下文件,节省手机空间:
.7z、.zip、*.rar.mp4、.mov、*.avi>50MB 的 .pptx / .ppt| 设备 | 要求 |
|---|---|
| ------ | ------ |
| Mac | macOS 11+,已安装 Syncthing |
| iPhone | iOS 15+,安装 Möbius Sync(App Store 免费) |
| 网络 | 两台设备在同一局域网,或配置远程发现 |
# 使用 Homebrew 安装
brew install syncthing
# 启动 Syncthing(后台运行)
brew services start syncthing
# 或前台运行(用于初次配置)
syncthing
浏览器访问 http://127.0.0.1:8384
在 Web 界面 → 「操作」→ 「显示 ID」,复制你的设备 ID(稍后 iPhone 端需要)。
# macOS 开机自启
brew services start syncthing
Obsidian Vault~/Documents/Obsidian VaultApp Store 搜索「Möbius Sync」,免费下载。
> 注意:免费版限制同步 20MB。如 vault 超过 20MB,需内购买断(¥38)。
回到 Mac 的 Syncthing Web 界面(http://127.0.0.1:8384),会看到 iPhone 的配对请求,点击「添加设备」。
关键步骤:将同步目标指向 Obsidian 的本地目录
Obsidian Vault回到 Mac 的 Syncthing Web 界面,确认 iPhone 的文件夹共享请求。
在 Mac 上创建同步脚本,自动排除大文件:
#!/usr/bin/env python3
"""同步 Obsidian Vault 到 iCloud/Möbius,排除大文件"""
import subprocess, os, tempfile
SRC = "~/Documents/Obsidian Vault" # 替换为你的 vault 路径
DST = "~/Library/Mobile Documents/com~apple~CloudDocs/Obsidian Vault" # 替换为目标路径
# 找出 >50MB 的 PPT 文件
result = subprocess.run(
["find", os.path.expanduser(SRC), "-type", "f",
"(", "-name", "*.pptx", "-o", "-name", "*.ppt", ")", "-size", "+50M"],
capture_output=True, text=True
)
big_ppts = result.stdout.strip().split("\n") if result.stdout.strip() else []
# 生成 exclude-from 文件
exclude_tmp = tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False)
exclude_tmp.write("*.7z\n*.zip\n*.rar\n*.mp4\n*.mov\n*.avi\n")
for f in big_ppts:
if f:
rel = f.replace(os.path.expanduser(SRC) + "/", "")
exclude_tmp.write(rel + "\n")
exclude_tmp.close()
# rsync 同步
cmd = ["rsync", "-av", "--update", f"--exclude-from={exclude_tmp.name}",
f"{os.path.expanduser(SRC)}/", f"{os.path.expanduser(DST)}/"]
subprocess.run(cmd)
os.unlink(exclude_tmp.name)
print(f"✅ 同步完成,已排除 {len(big_ppts)} 个大PPT文件")
python3 sync-obsidian.py
# 生成密码哈希
syncthing generate --password
# 编辑配置文件(~/.config/syncthing/config.xml)
# 找到 <gui> 标签,添加:
# <authenticationUser>admin</authenticationUser>
# <authenticationPassword>哈希值</authenticationPassword>
# 重启 Syncthing
brew services restart syncthing
Web 界面 → 「设置」→ 「连接」→「本地发现」开启,「全局发现」关闭。这样设备只在同局域网时同步。
Web 界面 → 文件夹设置 →「版本控制」→ 选择「简易文件版本控制」,建议保留最近 5-10 个版本。
A: 检查 Syncthing 引擎是否启用。Möbius Sync → 设置 → 确认 Syncthing 服务为 Running 状态。
A: Obsidian vault 超过 20MB 时,Möbius Sync 免费版会禁用同步。需内购买断(¥38,一次性)。
A:
A: Syncthing 会保留冲突版本(文件名加 .sync-conflict 后缀),不会覆盖。建议开启版本控制以防万一。
A: 确认 Möbius Sync 的同步路径指向的是 Obsidian 的本地目录(「我的 iPhone」→「Obsidian」→「Obsidian Vault」),而不是其他目录。
A: 在同步脚本的 exclude 列表中添加规则,如 .psd(设计文件)、.ai 等。
现有方案(如 GitHub 上的 obsidian-syncthing-integration)需要在 Obsidian 内安装 Syncthing 插件,存在以下问题:
本方案在文件系统层同步,与 Obsidian 完全解耦,更稳定可靠。
MIT License — 作者 KyleJia
Copyright (c) 2026 KyleJia
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
共 1 个版本