360 Secure SkillHub
360 安全技能中心

CoreLocationCLI

该 Skill 说明如何使用 CoreLocationCLI 在 macOS 上获取设备经纬度、海拔、速度等位置数据,并可按自定义格式或 JSON 输出,支持逆地理编码和持续监听。使用前需开启 Wi-Fi,首次运行可能需要系统授权。

jerrykfc
jerrykfc
热度 35.14
最近更新 2026-05-11 17:35:46
分类:生活依赖:代码执行应用场景:旅行 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add corelocationcli
Metadata
name
corelocationcli
description
Get the physical location of your macOS device and print it to stdout.
metadata
{"clawdbot":{"emoji":"📍","requires":{"bins":["swift"],"os":"macOS"}}}

CoreLocationCLI

Gets the physical location of your device and prints it to standard output. Kill it with CTRL-C.

Note: Make sure Wi-Fi is turned on, otherwise you will see kCLErrorDomain error 0.

Usage

CoreLocationCLI --help
CoreLocationCLI --version
CoreLocationCLI [--watch] [--verbose] [--format FORMAT]
CoreLocationCLI [--watch] [--verbose] --json
Switch Description
-h, --help Display help message and exit
--version Display the program version
-w, --watch Continually print location updates
-v, --verbose Show debugging output
-f, --format Print a string with the specified substitutions
-j, --json Print a JSON object with all available information

Format Specifiers

Location: %latitude %longitude %altitude %direction %speed %h_accuracy %v_accuracy %time

Reverse geocoding: %address %name %isoCountryCode %country %postalCode %administrativeArea %subAdministrativeArea %locality %subLocality %thoroughfare %subThoroughfare %region %timeZone %time_local

Default format: %latitude %longitude

Examples

CoreLocationCLI
# 50.943829 6.941043

CoreLocationCLI --format "%latitude %longitude\n%address"
# 50.943829 6.941043
# Kaiser-Wilhelm-Ring 21
#  Cologne North Rhine-Westphalia 50672
#  Germany

CoreLocationCLI --json
# {"latitude":"40.141196","longitude":"-75.034815","altitude":"92.00",...}

Installation

brew install cask corelocationcli

Gatekeeper

First run may be blocked by macOS Gatekeeper. Go to System Settings → Privacy & Security → Security to approve.