用终端在 Apple 备忘录中新建备忘
通过 osascript 的 AppleScript 命令向备忘录 App 添加一条带标题的备忘。
运行针对 Notes 应用的 osascript `make new note` 命令,即可创建带标题和正文的备忘。
01命令
命令
$ osascript -e 'tell application "Notes" to make new note at folder "Notes" of account "iCloud" with properties {name:"服务器日志", body:"<div>192.168.1.1 部署完成</div>
"}'02作用说明
AppleScript 将备忘录暴露为可脚本化应用,一行 osascript 就能创建带名称和 HTML 格式正文的备忘。适合把脚本运行结果记进备忘录,或在 shell 配置里做成快速记录命令。
03风险
!注意: 正文只支持有限的 HTML 子集(如 `<div>`、`<br>`),不是 Markdown;首次运行会要求授予终端“自动化”权限;备忘会同步到 iCloud,从“最近删除”恢复并不总是可靠。
04撤销
撤销
$ osascript -e 'tell application "Notes" to delete (first note of folder "Notes" of account "iCloud" whose name is "服务器日志")'05来源
- osascript – Execute AppleScripts and OSA scripts依据: Documents running AppleScript from the shell, including app automation like Notes
- Notes User Guide for Mac依据: Apple’s Notes app documentation
最后验证: 2026-09-18 · 分类: 系统与设置