Create and Read Apple Notes via CLI
- Reads Markdown from
--text,--file, or stdin - Converts it to HTML
- Creates a new note in Apple Notes (background-only) via
osascript - Derives the note title from the first non-empty line (prefers
# H1)
cd notescli
bun install
bun run buildRun directly:
node dist/index.js create --helpOnce you have a tap repo with Formula/notescli.rb (see homebrew/notescli.rb), install with:
brew install <owner>/<tap>/notescliTo cut a release artifact for Homebrew:
bun run package:releaseCreate a note from piped Markdown (defaults to folder Quick Notes):
echo "# Hello\n\nFrom an agent." | notescli createCreate a note from a file:
notescli create --file ./agent-output.mdMachine-readable output:
echo "# Hello" | notescli create --jsonDry run:
echo "# Hello" | notescli create --dry-runRead a note by id and output Markdown:
notescli read --id "x-coredata://..."--folderis a single folder name (no nesting). Default:Quick Notes.- If the folder does not exist (or is localized differently), the command fails with
Folder not found: .... - If
--accountis omitted, the tool uses the first account returned by Notes’ AppleScript API (no UI scripting).
Config is loaded via cosmiconfig for the module name notescli (e.g. .notesclirc, .notesclirc.json, notescli.config.json, etc.).
Supported keys:
folder(string)account(string, optional)
Environment variables:
NOTESCLI_FOLDERNOTESCLI_ACCOUNT
Precedence:
- CLI flags
- Env vars
- Config file
- Defaults
On first run, macOS may prompt you to allow automation control (e.g., “notescli would like to control Notes”).
If note creation fails due to permissions, check:
- System Settings → Privacy & Security → Automation → allow your terminal (or Node) to control “Notes”.