/yuyile-skills:macos-migrationfrom yuyile-skills
Two-phase macOS system migration: collects a JSON manifest of software, configs, and dev tools on the old Mac, then restores them on the new one. Requires a Time Machine backup and Homebrew.
Ships in yuyile-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
两阶段设计:旧系统采集 → 新系统还原。中间通过一个 JSON 清单文件衔接。
在旧系统上先做一次 Time Machine 全量备份。 这是整个迁移的安全网——新系统上 任何一步出问题,都能从这份全量备份里捞回来。还原阶段也直接从 Time Machine 挂载点 读取数据。
没有 Time Machine 全量备份,就不要开始迁移。
判断「采集还是还原」只看一个信号:清单文件在不在。
ls ~/migration-manifest.json 2>/dev/null
| 条件 | 模式 |
|---|---|
| 无清单文件 | 采集模式(在旧系统上,生成清单) |
| 有清单文件 | 还原模式(在新系统上,读清单还原) |
Time Machine 只是还原阶段的数据来源,不参与模式判断。 用户也可以直接指定:「采集」「备份」「还原」「迁移」。
which brew && brew --version || echo "NOT_INSTALLED"
已安装 → 继续
未安装 → 引导用户在终端手动执行安装命令。这一步需要输入管理员密码(sudo), 无法静默完成:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
装完后按提示把 brew 加入 PATH(Apple Silicon:eval "$(/opt/homebrew/bin/brew shellenv)"),
再继续。
在旧系统上运行,扫描所有软件、配置、开发环境,生成 ~/migration-manifest.json。
brew list --formula
brew list --cask
brew tap
ls /Applications/
ls ~/Applications/ 2>/dev/null
与 Homebrew cask 列表对比,标记哪些是 Homebrew 装的、哪些是手动/App Store 装的。
mas list 2>/dev/null || echo "mas not installed"
如果 mas 未安装,提示用户是否要安装(brew install mas)。
npm ls -g --depth=0 2>/dev/null
uv tool list 2>/dev/null
pip list 2>/dev/null
pipx list 2>/dev/null
ls ~/go/bin/ 2>/dev/null
扫描 home 目录下的 dotfiles 和配置目录:
ls -la ~/
重点采集:
.zshrc, .zshenv, .zprofile, .bashrc, .bash_profile.gitconfig, .gitignore_global.ssh/.claude/, .codex/, .config/, .cursor/, .zed/.docker/, .kube/.npm/, .nvm/, .bun/, .cargo/, .rustup/.SwitchHosts/, .ollama/, .syncthing/ 等敏感数据先问后采:.ssh/(私钥)、dotfiles 里可能含 token、.aws/、.kube/、
钥匙串等都是密钥级信息。采集这些之前先问用户是否纳入:
"skipped_sensitive": [...],让用户日后
自行手动迁移(差异报告里也会再列一次)。ls ~/Library/LaunchAgents/
列出 home 目录下非 dotfile 的顶层目录:
ls -d ~/*/ 2>/dev/null
排除系统目录(Library, Applications, Public 等),记录用户自建的项目/数据目录。
# 当前 shell 版本
zsh --version
# Homebrew 路径 / 版本管理器(nvm、fnm 等)配置
grep -iE 'brew|nvm|fnm' ~/.zshrc
迁移时最容易漏、丢了又很烦的几类:
# 编辑器扩展
code --list-extensions 2>/dev/null
cursor --list-extensions 2>/dev/null
# 自购/自装字体
ls ~/Library/Fonts/ 2>/dev/null
# 定时任务
crontab -l 2>/dev/null
# 手动装到非 Homebrew 路径的命令行工具
ls /usr/local/bin/ 2>/dev/null
ls /opt/ 2>/dev/null
系统偏好(
defaults)量大且与机型强相关,不自动采集;如用户在意,在还原差异 报告里提醒手动核对(键盘、触控板、Dock、快捷键等)。
将以上所有信息写入 ~/migration-manifest.json:
{
"version": 1,
"captured_at": "2026-06-28T16:00:00+08:00",
"source_macos": "15.5",
"source_hostname": "old-macbook",
"homebrew": {
"taps": ["user/repo", "..."],
"formulas": ["git", "node@22", "..."],
"casks": ["1password", "docker-desktop", "..."]
},
"applications": {
"homebrew_casks": ["claude", "firefox", "..."],
"app_store": [{"id": 123456, "name": "App Name"}],
"manual": ["Final Cut Pro.app", "..."]
},
"package_managers": {
"npm_global": ["@anthropic-ai/claude-code", "..."],
"uv_tools": ["nano-pdf", "..."],
"pip_packages": ["package1", "..."],
"go_binaries": ["tool1", "..."]
},
"configs": {
"dotfiles": [".zshrc", ".gitconfig", ".ssh", "..."],
"config_dirs": [".claude", ".codex", ".config", ".docker", "..."],
"app_support_keys": ["Syncthing", "obs-studio", "..."]
},
"editor_extensions": {
"vscode": ["ms-python.python", "..."],
"cursor": ["..."]
},
"fonts": ["MyFont.otf", "..."],
"crontab": "<crontab -l 原文,无则空>",
"manual_bins": ["/usr/local/bin/foo", "/opt/bar", "..."],
"launch_agents": ["com.github.syncthing.plist", "..."],
"user_dirs": ["Projects", "Sites", "..."],
"shell": {
"shell": "zsh",
"brew_in_path": true,
"nvm_installed": true,
"custom_env_vars": {}
},
"skipped_sensitive": []
}
输出清单摘要,提示用户:
✅ 采集完成!清单已保存到 ~/migration-manifest.json
采集内容:
- Homebrew: X taps, Y formulas, Z casks
- 应用: X 个 Homebrew, Y 个 App Store, Z 个手动安装
- npm 全局包: X 个
- 配置文件: X 个 dotfiles, Y 个配置目录
- 编辑器扩展: X 个 / 字体: Y 个 / 定时任务: 有/无
- 自启动服务: X 个
- 用户目录: X 个
- 跳过的敏感项: X 个(用户选择不采集)
⚠️ 若采集了 .ssh / dotfiles 中的凭据,清单与备份含私钥,传输存放注意不要外泄。
下一步:确认已有 Time Machine 全量备份,将 migration-manifest.json 复制到新系统,
再次运行此 skill。
在新系统上运行,读取 migration-manifest.json 并逐步还原。
ls ~/migration-manifest.json
如果不存在:
找不到 migration-manifest.json。
请将旧系统上采集的清单文件复制到新系统的 home 目录:
scp old-mac:~/migration-manifest.json ~/migration-manifest.json
或者手动指定路径。
前提:第零步已确认 Homebrew 装好(需用户手动输密码安装)。装好之后这一步才能跑。
读取清单中的 homebrew 字段。
# 添加 taps(逐个)
brew tap <user>/<repo>
# 信任第三方 taps
brew trust <user>/<repo>
# 安装 formulas(批量,失败不回滚整批)
brew install <formula1> <formula2> ...
# 安装 casks(逐个,避免回滚)
for cask in <cask1> <cask2> ...; do
brew install --cask "$cask" 2>&1 | tail -3
done
没装上的(需 sudo、网络失败等)先记下,最后在 B7 差异报告统一列给用户。
读取清单中的 package_managers 字段。
# npm
npm install -g <pkg1> <pkg2> ...
# uv
uv tool install <pkg1> <pkg2> ...
# pip(如果需要)
pip install <pkg1> <pkg2> ...
# go binaries
go install <pkg1>@latest <pkg2>@latest ...
读取清单中的 configs 字段。
有两种数据来源,优先级:
TM="<Time Machine 用户目录路径>"
LOCAL="/Users/<username>"
# dotfiles
rsync -av --ignore-existing "$TM/.zshrc" "$LOCAL/"
rsync -av --ignore-existing "$TM/.gitconfig" "$LOCAL/"
rsync -av --ignore-existing "$TM/.ssh/" "$LOCAL/.ssh/"
# 配置目录
for dir in .claude .codex .config .docker .SwitchHosts ...; do
rsync -av --ignore-existing "$TM/$dir/" "$LOCAL/$dir/"
done
恢复
.ssh/后确认权限:chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_*。 如无 Time Machine,提示用户提供配置文件的来源路径。
从 Time Machine 恢复(如果有):
| 子目录 | 命令 | 说明 |
|---|---|---|
| Preferences | cp -rn | 应用偏好设置 |
| Keychains | cp -rn | 钥匙串 |
| Containers | cp -rn | 沙盒应用数据 |
| Group Containers | cp -rn | 共享容器 |
cp -rn | 邮件数据 | |
| Safari | cp -rn | 书签/历史 |
rsync 在 Time Machine APFS 快照上会报
io_read_flush错误,Library 用cp -rn。
读取清单中的 launch_agents 字段。
逐个检查并创建对应的 plist 文件,然后 launchctl load。
对应采集阶段的 A12:
# 编辑器扩展(逐个装)
for ext in <清单 editor_extensions.vscode>; do code --install-extension "$ext"; done
# 字体
rsync -av --ignore-existing "$TM/Library/Fonts/" "$LOCAL/Library/Fonts/"
# 定时任务:先看新机器有没有现成的,再决定是否合并写入,避免覆盖
crontab -l 2>/dev/null
/usr/local/bin、/opt里的手动安装工具无法自动还原,列入 B7 差异报告提醒用户。
对比清单和实际安装结果,输出差异:
## 还原差异报告
### ❌ 安装失败(需手动处理)
- docker-desktop: 需要 sudo → 手动执行 `brew install --cask docker-desktop`
- tailscale-app: 需要 sudo → 手动执行 `brew install --cask tailscale-app`
- android-platform-tools: 网络问题 → 稍后重试
### ⚠️ 清单中有但无 Homebrew cask
- Final Cut Pro: App Store 应用
- DaVinci Resolve Studio: 手动下载 → blackmagicdesign.com
### ℹ️ App Store 应用(需手动安装或用 mas)
- GarageBand
- Infuse
### 🔧 需手动核对(非软件)
- 系统偏好 defaults:键盘 / 触控板 / Dock / 快捷键
- /usr/local/bin、/opt 手动工具:<manual_bins 列表>
- 拒绝采集的敏感项:<skipped_sensitive 列表>
brew bundle 一个失败全部回滚问题:brew bundle --file=Brewfile 中任何一个 cask 下载失败,整批已安装的包全部回滚。
解决:不用 brew bundle。taps 逐个添加,formulas 批量安装,casks 逐个安装。
问题:Homebrew 6+ 要求显式信任第三方 taps,否则报 Refusing to load cask from untrusted tap。
解决:brew trust <user>/<repo>
问题:rsync -av --ignore-existing 复制 Library 子目录时报 io_read_flush 错误。
解决:Library 子目录改用 cp -rn。
cp -rn 的 "Operation not permitted"问题:macOS SIP/TCC 保护的文件无法直接复制(系统 Preferences、Mail 数据库等)。
影响:不影响使用。系统或应用在首次启动时自动重建。
cp -rn 的 "Not a directory" 错误问题:Containers 中系统容器使用符号链接指向标准目录。
影响:不影响使用。用户应用的容器数据已正确复制。
问题:docker-desktop、tailscale-app、adobe-creative-cloud 安装时需要 sudo。
解决:记录在差异报告中,让用户手动执行。
问题:brew install node@22 后 brew link 失败。
解决:brew link --overwrite node@22
问题:旧系统上通过 DMG/PKG/App Store 安装的软件,Homebrew 无法感知。
解决:采集阶段扫描 /Applications/ 并与 brew list --cask 对比,标记出手动安装的应用,还原时单独处理。
--ignore-existing 或 -nbrew bundle 的回滚问题brew list 确认,复制后 du -sh 验证大小What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
macos-migration, system-setup, data-migration, time-machine, homebrew
Generated from the plugin's indexed repository (ttfake92-lab/skills) — no native marketplace selected
npx claudepluginhub p/ttfake92-lab-yuyile-skills12 skills in this plugin
/archival-fragments从一个想法或一份文案,做出一条完整的「档案剪贴」风格短片——满幅象牙纸、单色印刷黑白、单一暗砖红,镜头用 MiniMax H3 首尾帧驱动,配音用 Fish Audio,成片用 ffmpeg 合成。当用户想用档案剪贴/编辑设计/纸质拼贴风格做视频,或要把一段文案、一个选题、一条新闻做成解说短片时使用。包含环境安装检查、拆故事拆画面拆节奏、逐镜生成、变速拼片的完整流程。/archival-fragments-lite「档案剪贴」视觉风格 + 关键帧串联首尾帧方法。满幅象牙纸、单色印刷黑白、单一暗砖红;先出一串各不相同的参考图,再用相邻两张作为首尾帧生成镜头,接点严丝合缝。不绑定任何具体模型,任何支持首尾帧的视频工具都能用。当用户要做档案剪贴/纸质拼贴/编辑设计风格的短片,或想用首尾帧方式做连贯分镜时使用。/claude-local-reset在 macOS 与 Windows 上备份重置 Claude Desktop 本地状态,检查网络出口、DNS/WebRTC、代理与中转配置,自动交付 HTML 质检回执和可跳转的 Claude 防封号指南。使用时先停下来确认任务范围:清除 Claude 本地使用痕迹,或只做网络检查;指南分别引导首次使用与曾被限制用户完成手动准备(时区、出口、TUN、登录前自检、账号与支付、日常使用、出发前清单)、调用 skill 质检。可单独检查环境;不承诺解除服务器关联或防止封号。Linux 与未核实的安装方式不要套用。/college-application通过 Agent 对话帮助中国高考考生完成志愿填报决策:先做有科学依据的性格与职业兴趣测评,再研究适合的职业、专业和行业,最后结合省份、选科、分数/位次与官方招生数据生成可追溯来源的 HTML 报告。用户提到高考志愿、college application、选大学、选专业、性格测试、职业方向、行业前景、投档线、录取概率、冲稳保或志愿模拟时使用。/yyl-benchmark-breakdown拆解对标账号 / 竞品内容——丢一个链接进来,自动识别平台(抖音/小红书/B站/YouTube/公众号)和粒度(单条 or 整个账号),抓取内容后输出三件套:可复用爆款公式、画面+口播逐段拆解、人设与内容定位,并自动存档到 benchmarks/。短视频自动下载 + 转写口播 + 抽视觉帧(contact sheet 多模态读图),不只看 caption。当用户说「拆解这个账号/视频/笔记」「分析对标/竞品」「这条为什么火」「给链接拆内容」「teardown」「看看别人怎么做的」时使用。抓不到内容会引导粘贴文案/字幕,绝不直接报错。/yyl-disk-cleaner-cat像素小猫帮你清理 macOS 磁盘、优化空间与性能。扫描开发者缓存 / 系统缓存 / 大文件下载,给出性能与网络优化建议,然后打开一个「像素风网页」让你勾选确认——确认后一只 3D 像素小猫在房间里实时打扫,灰尘堆随真实删除进度缩小。带持续记忆:每次清理了什么、你的偏好都记在 ~/.disk-cleanup-cat/,下次更懂你。当用户说「清理磁盘 / 清理空间 / 磁盘满了 / C盘满了 / 优化电脑 / 优化性能 / 电脑变慢了 / 清缓存 / disk cleanup / free up space」时使用。仅限 macOS。Other plugins' skills for the same job