Create a Calendar Event from the Terminal
Add a titled, timed event to a specific macOS Calendar via AppleScript.
Run an osascript `make new event with properties {summary:..., start date:..., end date:...}` inside the target calendar.
01Command
Command
$ osascript -e 'tell application "Calendar" to tell calendar "个人" to make new event with properties {summary:"硬盘备份", start date:date "2026年9月19日 下午9:00", end date:date "2026年9月19日 下午11:00"}'02What it does
Calendar is scriptable through AppleScript, so scripts can insert events without opening the app — useful for automatically booking backup windows or reminder blocks from a deploy script. Events must specify both start and end dates, and the calendar name must match exactly.
03Risk
!Warning: First run requires granting Terminal Automation access; deleted events may still alert if deletion happens after alerts fired. iCloud calendars created this way sync across devices.
04Undo
Undo
$ osascript -e 'tell application "Calendar" to delete (first event of calendar "个人" whose summary is "硬盘备份")'05Sources
- Use Calendar on MacEvidence: Apple Calendar documentation for Mac
- osascript – Execute AppleScripts and OSA scriptsEvidence: osascript can drive scriptable apps including Calendar
Last verified: 2026-09-18 · Category: System & Settings