介绍
# Find My Location
通过 Apple“查找”以街角级精度跟踪共享联系人。
## 系统要求
- **macOS** 13+ 并安装了“查找”App - **Python** 3.9+ - **iCloud 账户** 在您的 Mac 上已登录(用于访问“查找”) - **位置共享** 已从您要跟踪的联系人处启用 - **peekaboo** - 屏幕读取 CLI ([GitHub](https://github.com/steipete/peekaboo)) - **Hammerspoon**(可选)- 用于可靠的 UI 点击 ([hammerspoon.org](https://www.hammerspoon.org/))
## 前置条件
### 1. iCloud 与“查找”设置
您的 Mac 必须登录到启用了“查找”的 iCloud 账户: - 系统设置 → Apple ID → iCloud → 查找我的 Mac(已启用) - 您要跟踪的人必须通过“查找”将其位置共享给此 iCloud 账户
### 2. 安装 peekaboo
```bash brew install steipete/tap/peekaboo ```
当系统提示时,授予 **辅助功能** 和 **屏幕录制** 权限(系统设置 → 隐私与安全性)。
### 3. 安装 Hammerspoon(可选但推荐)
Hammerspoon 提供可靠的点击功能,适用于所有 App。如果没有它,点击可能会偶尔误触到错误的窗口。
```bash brew install hammerspoon open -a Hammerspoon ```
添加到 `~/.hammerspoon/init.lua`: ```lua local server = hs.httpserver.new(false, false) server:setPort(9090) server:setCallback(function(method, path, headers, body) local data = body and hs.json.decode(body) or {} if path == "/click" then hs.eventtap.leftClick({x=data.x, y=data.y}) return hs.json.encode({status="clicked", x=data.x, y=data.y}), 200, {} end return hs.json.encode({error="not found"}), 404, {} end) server:start() ```
重新加载配置(Hammerspoon 菜单 → Reload Config),然后创建 `~/.local/bin/hsclick`: ```bash #!/bin/bash curl -s -X POST localhost:9090/click -d "{\"x\":$2,\"y\":$3}" chmod +x ~/.local/bin/hsclick ```
## 安装
```bash git clone https://github.com/poiley/findmy-location.git cd findmy-location ./install.sh ```
或通过 ClawdHub: ```bash clawdhub install findmy-location ```
## 配置
创建 `~/.config/findmy-location/config.json`: ```json { "target": "John", "known_locations": [ { "name": "home", "address": "123 Main St, City, ST", "markers": ["landmark near home"] }, { "name": "work", "address": "456 Office Blvd, City, ST", "markers": ["landmark near work"] } ] } ```
| 字段 | 描述 | |-------|-------------| | `target` | 要跟踪的联系人名称(可选 - 默认为第一个共享联系人) | | `known_locations` | 您想要用地址标记的地点数组 | | `markers` | 当处于该位置时,“查找”地图上可见的地标 |
## 使用方法
```bash findmy-location # Human-readable output findmy-location --json # JSON output ```
### 输出示例
``` 123 Main St, City, ST (home) - Now ```
```json { "person": "[email protected]", "address": "Main St & 1st Ave", "city": "Anytown", "state": "WA", "status": "Now", "context": "out", "screenshot": "/tmp/findmy-12345.png", "needs_vision": false } ```
| 字段 | 描述 | |-------|-------------| | `context` | `home`(家)、`work`(公司)、`out`(外出)或 `unknown`(未知) | | `needs_vision` | 如果为 `true`,则对截图使用 AI 视觉来读取街道名称 | | `screenshot` | 捕获的地图图像路径 |
## 工作原理
1. 打开“查找”App 并选择目标联系人 2. 捕获地图并读取辅助功能数据 3. 将可见地标与配置的已知位置进行匹配 4. 返回地址和上下文,或标记以进行视觉分析
## 故障排除
| 问题 | 解决方案 | |-------|----------| | 点击错误的窗口 | 安装 Hammerspoon(见前置条件) | | “未找到此人” | 确保在“查找”中启用了位置共享 | | 始终显示 `needs_vision: true` | 为常去的地方添加标记 | | 权限错误 | 授予 peekaboo 辅助功能 + 屏幕录制访问权限 |
## 许可证
MIT