Create a Calendar Event from the Terminal

Add a titled, timed event to a specific macOS Calendar via AppleScript.

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

RiskMedium risk
RequirementsCalendar app with the target calendar visible; Automation permission for Terminal.
!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

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