Create a Note in Apple Notes from the Terminal
Use osascript AppleScript to add a titled note to your Notes app.
Run an osascript `make new note` command targeting the Notes app to insert a note with a title and body.
01Command
Command
$ 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>
"}'02What it does
AppleScript exposes Notes as a scriptable application, so one osascript line can create a note with a name and HTML-style body. This is handy for logging script results into Notes, or building quick capture commands aliased in your shell profile.
03Risk
!Warning: The body uses a limited HTML subset (`<div>`, `<br>`), not Markdown. The first run will prompt you to grant Terminal Automation access to Notes; notes sync to iCloud and cannot be undeleted from the Trash reliably.
04Undo
Undo
$ osascript -e 'tell application "Notes" to delete (first note of folder "Notes" of account "iCloud" whose name is "服务器日志")'05Sources
- osascript – Execute AppleScripts and OSA scriptsEvidence: Documents running AppleScript from the shell, including app automation like Notes
- Notes User Guide for MacEvidence: Apple’s Notes app documentation
Last verified: 2026-09-18 · Category: System & Settings