Create a Note in Apple Notes from the Terminal

Use osascript AppleScript to add a titled note to your Notes app.

macOSnotesosascriptautomationMedium risk
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

RiskMedium risk
RequirementsNotes app signed in to an iCloud account; Automation permission for Terminal (System Settings → Privacy & Security).
!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

Last verified: 2026-09-18 · Category: System & Settings