默认路径
模拟器数据(设备 + 运行时)默认在:
~/Library/Developer/CoreSimulator
运行时(.simruntime)在:
/Library/Developer/CoreSimulator/Profiles/Runtimes
方案:用符号链接(symlink)迁移到新目录
1. 关闭 Xcode & 模拟器
- 完全退出 Xcode
- 退出所有模拟器窗口
2. 终止 CoreSimulator 服务(关键)
运行
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
3. 把现有模拟器目录整体移到新位置
示例:移到外置硬盘 Develop,路径 /Volumes/Develop/Xcode/CoreSimulator
运行
# 先建目标目录
mkdir -p /Volumes/Develop/Xcode/CoreSimulator
# 移动原有全部内容
mv ~/Library/Developer/CoreSimulator/* /Volumes/Develop/Xcode/CoreSimulator/
4. 创建符号链接(让 Xcode 以为还在原路径)
运行
# 先删掉原来的目录(已空)
rm -rf ~/Library/Developer/CoreSimulator
# 创建软链指向新位置
ln -s /Volumes/Develop/Xcode/CoreSimulator ~/Library/Developer/CoreSimulator
5. 运行时(Runtimes)也想移?(可选)
运行
sudo ln -s /Volumes/MyExternal/Xcode/CoreSimulator/Profiles /Library/Developer/CoreSimulator/Profiles
6. 验证
运行
# 查看模拟器列表,正常不报错即可
xcrun simctl list
打开 Xcode → Window → Devices and Simulators,模拟器都在,下载新模拟器也会自动落到新目录。